about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorrajdakin <loic_chevalier@yahoo.fr>2021-06-04 22:59:17 +0200
committerrajdakin <loic_chevalier@yahoo.fr>2021-06-04 23:01:56 +0200
commit8d97f136772d43a27b25ccfba872c908ceafe617 (patch)
treeecbfb72d23362c743c3aeea06d63d37c3008c339
parent75c4c3d6b92bd82c1cd5c9a659b354127559a43c (diff)
downloadbox64-8d97f136772d43a27b25ccfba872c908ceafe617.tar.gz
box64-8d97f136772d43a27b25ccfba872c908ceafe617.zip
Fixed some wrapped functions, upgraded the python script
-rwxr-xr-xrebuild_wrappers.py55
-rwxr-xr-xsrc/include/box64context.h1
-rw-r--r--src/wrapped/generated/functions_list.txt4
-rw-r--r--src/wrapped/generated/wrappedfontconfigtypes.h19
-rw-r--r--src/wrapped/generated/wrapper.c2
-rw-r--r--src/wrapped/generated/wrapper.h1
-rwxr-xr-xsrc/wrapped/wrappedbz2.c13
-rwxr-xr-xsrc/wrapped/wrappedcrypto.c28
-rwxr-xr-xsrc/wrapped/wrappedcurl.c7
-rwxr-xr-xsrc/wrapped/wrappeddbus.c26
-rwxr-xr-xsrc/wrapped/wrappedfontconfig.c33
-rwxr-xr-xsrc/wrapped/wrappedfontconfig_private.h2
-rwxr-xr-xsrc/wrapped/wrappedgnutls.c8
-rwxr-xr-xsrc/wrapped/wrappedldlinux_private.h8
-rwxr-xr-xsrc/wrapped/wrappedlibasound.c24
-rwxr-xr-xsrc/wrapped/wrappedlibc.c25
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h4
-rwxr-xr-xsrc/wrapped/wrappedlibgl.c2
-rwxr-xr-xsrc/wrapped/wrappedlibglu.c24
-rwxr-xr-xsrc/wrapped/wrappedlibsm.c9
-rwxr-xr-xsrc/wrapped/wrappedlibssl.c16
-rwxr-xr-xsrc/wrapped/wrappedlibtinfo.c5
-rwxr-xr-xsrc/wrapped/wrappedlibtinfo6.c5
-rwxr-xr-xsrc/wrapped/wrappedlibx11.c71
-rwxr-xr-xsrc/wrapped/wrappedlibx11_private.h2
-rwxr-xr-xsrc/wrapped/wrappedlibxext.c25
-rwxr-xr-xsrc/wrapped/wrappedlibxt.c7
-rwxr-xr-xsrc/wrapped/wrappedlibxtst.c6
-rwxr-xr-xsrc/wrapped/wrappedopenal.c25
-rwxr-xr-xsrc/wrapped/wrappedpango.c5
-rwxr-xr-xsrc/wrapped/wrappedpng16.c18
-rwxr-xr-xsrc/wrapped/wrappedpulse.c2
32 files changed, 132 insertions, 350 deletions
diff --git a/rebuild_wrappers.py b/rebuild_wrappers.py
index 67be322b..5eea0ea3 100755
--- a/rebuild_wrappers.py
+++ b/rebuild_wrappers.py
@@ -1,5 +1,7 @@
 #!/usr/bin/env python3
 
+# TODO: same as for box86, flac can't be auto-generated yet
+
 try:
 	# Python 3.5.2+ (NewType)
 	from typing import Union, List, Sequence, Dict, Tuple, NewType, TypeVar
@@ -79,8 +81,7 @@ class FunctionType(str):
 assert(all(c not in FunctionType.values[:i] for i, c in enumerate(FunctionType.values)))
 
 RedirectType = NewType('RedirectType', FunctionType)
-#DefineType = NewType('DefineType', str)
-DefineType = str
+DefineType = NewType('DefineType', str)
 
 T = TypeVar('T')
 U = TypeVar('U')
@@ -95,11 +96,11 @@ class Define:
 	
 	defines: List[DefineType] = []
 	
-	def __init__(self, name: DefineType, inverted_: bool):
+	def __init__(self, name: str, inverted_: bool):
 		# All values of "name" are included in defines (throw otherwise)
-		if name not in self.defines:
+		if DefineType(name) not in self.defines:
 			raise KeyError(name)
-		self.name = name
+		self.name = DefineType(name)
 		self.inverted_ = inverted_
 	def copy(self) -> "Define":
 		return Define(self.name, self.inverted_)
@@ -124,7 +125,7 @@ class Define:
 		else:
 			return "defined(" + self.name + ")"
 @final
-class Defines:
+class Clause:
 	defines: List[Define]
 	
 	def __init__(self, defines: Union[List[Define], str] = []):
@@ -141,8 +142,8 @@ class Defines:
 				)
 		else:
 			self.defines = [d.copy() for d in defines]
-	def copy(self) -> "Defines":
-		return Defines(self.defines)
+	def copy(self) -> "Clause":
+		return Clause(self.defines)
 	
 	def append(self, define: Define) -> None:
 		self.defines.append(define)
@@ -159,22 +160,22 @@ class Clauses:
 	Represent a list of clauses, aka a list of or-ed together and-ed "defined"
 	conditions
 	"""
-	definess: List[Defines]
+	definess: List[Clause]
 	
-	def __init__(self, definess: Union[List[Defines], str] = []):
+	def __init__(self, definess: Union[List[Clause], str] = []):
 		if isinstance(definess, str):
 			if definess == "()":
 				self.definess = []
 			elif ") || (" in definess:
-				self.definess = list(map(Defines, definess[1:-1].split(") || (")))
+				self.definess = list(map(Clause, definess[1:-1].split(") || (")))
 			else:
-				self.definess = [Defines(definess)]
+				self.definess = [Clause(definess)]
 		else:
 			self.definess = definess[:]
 	def copy(self) -> "Clauses":
 		return Clauses(self.definess[:])
 	
-	def add(self, defines: Defines) -> None:
+	def add(self, defines: Clause) -> None:
 		self.definess.append(defines)
 	
 	def splitdef(self) -> List[int]:
@@ -218,10 +219,12 @@ def readFiles(files: Sequence[Filename]) -> \
 	redirects : Dict[ClausesStr, Dict[RedirectType, FunctionType]] = {}
 	mytypedefs: Dict[Filename,   Dict[RedirectType, List[str]]]    = {}
 	
+	halt_required = False # Is there a GO(*, .FE*)?
+	
 	# First read the files inside the headers
 	for filepath in files:
-		filename: str = filepath.split("/")[-1]
-		dependants: Defines = Defines()
+		filename: Filename = filepath.split("/")[-1]
+		dependants: Clause = Clause()
 		with open(filepath, 'r') as file:
 			for line in file:
 				ln = line.strip()
@@ -255,6 +258,7 @@ def readFiles(files: Sequence[Filename]) -> \
 				elif ln.startswith("GO"):
 					# ... then look at the second parameter of the line
 					try:
+						gotype = ln.split("(")[0].strip()
 						funname = ln.split(",")[0].split("(")[1].strip()
 						ln = ln.split(",")[1].split(")")[0].strip()
 					except IndexError as e:
@@ -282,6 +286,10 @@ def readFiles(files: Sequence[Filename]) -> \
 						gbl[str(dependants)].append(FunctionType(ln))
 					
 					if ln[2] == "E":
+						if (gotype != "GOM"):
+							if (gotype != "GO2") or not (line.split(',')[2].split(')')[0].strip().startswith('my_')):
+								print("\033[91mThis is probably not what you meant!\033[m ({0}:{1})".format(filename, line[:-1]))
+								halt_required = True
 						# filename isn't stored with the '_private.h' part
 						if len(ln) > 3:
 							funtype = RedirectType(FunctionType(ln[:2] + ln[3:]))
@@ -290,6 +298,13 @@ def readFiles(files: Sequence[Filename]) -> \
 						mytypedefs.setdefault(filename[:-10], {})
 						mytypedefs[filename[:-10]].setdefault(funtype, [])
 						mytypedefs[filename[:-10]][funtype].append(funname)
+					# OK on box64
+					# elif gotype == "GOM":
+					# 	print("\033[94mAre you sure of this?\033[m ({0}:{1})".format(filename, line[:-1]))
+					# 	halt_required = True
+	
+	if halt_required:
+		raise ValueError("Fix all previous errors before proceeding")
 	
 	if ("" not in gbl) or ("" not in redirects):
 		print("\033[1;31mThere is suspiciously not many types...\033[m")
@@ -315,7 +330,7 @@ def sortArrays(
 	# be generated. There is also a filter to avoid duplicate/opposite clauses.
 	gbl_vals: Dict[FunctionType, Clauses] = {}
 	for k1 in gbl_tmp:
-		ks = Defines(k1)
+		ks = Clause(k1)
 		for v in gbl_tmp[k1]:
 			if k1 == "":
 				# Unconditionally define v
@@ -338,7 +353,7 @@ def sortArrays(
 					gbl_vals[v].add(ks)
 				
 			else:
-				gbl_vals[v] = Clauses([Defines(k1)])
+				gbl_vals[v] = Clauses([Clause(k1)])
 	
 	for v in gbl_vals:
 		strdefines = list(map(str, gbl_vals[v].definess))
@@ -372,7 +387,7 @@ def sortArrays(
 	# to an already defined type (with some remapping).
 	redirects_vals: Dict[Tuple[RedirectType, FunctionType], Clauses] = {}
 	for k1 in red_tmp:
-		ks = Defines(k1)
+		ks = Clause(k1)
 		for v in red_tmp[k1]:
 			if k1 == "":
 				# Unconditionally define v
@@ -395,7 +410,7 @@ def sortArrays(
 					redirects_vals[(v, red_tmp[k1][v])].add(ks)
 			
 			else:
-				redirects_vals[(v, red_tmp[k1][v])] = Clauses([Defines(k1)])
+				redirects_vals[(v, red_tmp[k1][v])] = Clauses([Clause(k1)])
 	# Also does the same trick as before (also helps keep the order
 	# in the file deterministic)
 	redirects: Dict[ClausesStr, List[Tuple[RedirectType, FunctionType]]] = {}
@@ -942,7 +957,7 @@ if __name__ == '__main__':
 	for i, v in enumerate(sys.argv):
 		if v == "--":
 			limit.append(i)
-	Define.defines = sys.argv[2:limit[0]]
+	Define.defines = list(map(DefineType, sys.argv[2:limit[0]]))
 	if main(sys.argv[1], sys.argv[limit[0]+1:], "2.0.1.14") != 0:
 		exit(2)
 	exit(0)
diff --git a/src/include/box64context.h b/src/include/box64context.h
index a83d79ec..7ff6d8c0 100755
--- a/src/include/box64context.h
+++ b/src/include/box64context.h
@@ -146,6 +146,7 @@ typedef struct box64context_s {
     library_t           *asound;
     library_t           *pulse;
     library_t           *d3dadapter9;
+    library_t           *libglu;
 
     int                 deferedInit;
     elfheader_t         **deferedInitList;
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 5b7f0a6b..fc3754b4 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -906,7 +906,6 @@
 #() iFEpilpV
 #() iFEpippi
 #() iFEpuppp
-#() iFEppiLi
 #() iFEppppp
 #() iFiiiiii
 #() iFiiiiip
@@ -1359,9 +1358,6 @@ wrappedflac:
   - FLAC__metadata_chain_read_with_callbacks
 - iFppppppppp:
   - FLAC__stream_decoder_init_stream
-wrappedfontconfig:
-- iFppiLi:
-  - FcPatternAddWeak
 wrappedfreetype:
 - iFpplp:
   - FT_Open_Face
diff --git a/src/wrapped/generated/wrappedfontconfigtypes.h b/src/wrapped/generated/wrappedfontconfigtypes.h
deleted file mode 100644
index 20aace5f..00000000
--- a/src/wrapped/generated/wrappedfontconfigtypes.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************
- * File automatically generated by rebuild_wrappers.py (v2.0.1.14) *
- *******************************************************************/
-#ifndef __wrappedfontconfigTYPES_H_
-#define __wrappedfontconfigTYPES_H_
-
-#ifndef LIBNAME
-#error You should only #include this file inside a wrapped*.c file
-#endif
-#ifndef ADDED_FUNCTIONS
-#define ADDED_FUNCTIONS() 
-#endif
-
-typedef int64_t (*iFppiLi_t)(void*, void*, int64_t, uintptr_t, int64_t);
-
-#define SUPER() ADDED_FUNCTIONS() \
-	GO(FcPatternAddWeak, iFppiLi_t)
-
-#endif // __wrappedfontconfigTYPES_H_
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index ea106aa5..d8af237e 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -940,7 +940,6 @@ typedef int64_t (*iFEpiipV_t)(x64emu_t*, void*, int64_t, int64_t, void*, void*);
 typedef int64_t (*iFEpilpV_t)(x64emu_t*, void*, int64_t, intptr_t, void*, void*);
 typedef int64_t (*iFEpippi_t)(x64emu_t*, void*, int64_t, void*, void*, int64_t);
 typedef int64_t (*iFEpuppp_t)(x64emu_t*, void*, uint64_t, void*, void*, void*);
-typedef int64_t (*iFEppiLi_t)(x64emu_t*, void*, void*, int64_t, uintptr_t, int64_t);
 typedef int64_t (*iFEppppp_t)(x64emu_t*, void*, void*, void*, void*, void*);
 typedef int64_t (*iFiiiiii_t)(int64_t, int64_t, int64_t, int64_t, int64_t, int64_t);
 typedef int64_t (*iFiiiiip_t)(int64_t, int64_t, int64_t, int64_t, int64_t, void*);
@@ -2233,7 +2232,6 @@ void iFEpiipV(x64emu_t *emu, uintptr_t fcn) { iFEpiipV_t fn = (iFEpiipV_t)fcn; R
 void iFEpilpV(x64emu_t *emu, uintptr_t fcn) { iFEpilpV_t fn = (iFEpilpV_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (intptr_t)R_RDX, (void*)R_RCX, (void*)(R_RSP + 8)); }
 void iFEpippi(x64emu_t *emu, uintptr_t fcn) { iFEpippi_t fn = (iFEpippi_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int64_t)R_R8); }
 void iFEpuppp(x64emu_t *emu, uintptr_t fcn) { iFEpuppp_t fn = (iFEpuppp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); }
-void iFEppiLi(x64emu_t *emu, uintptr_t fcn) { iFEppiLi_t fn = (iFEppiLi_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (uintptr_t)R_RCX, (int64_t)R_R8); }
 void iFEppppp(x64emu_t *emu, uintptr_t fcn) { iFEppppp_t fn = (iFEppppp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); }
 void iFiiiiii(x64emu_t *emu, uintptr_t fcn) { iFiiiiii_t fn = (iFiiiiii_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (int64_t)R_R9); }
 void iFiiiiip(x64emu_t *emu, uintptr_t fcn) { iFiiiiip_t fn = (iFiiiiip_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (void*)R_R9); }
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
index 75b72daf..d7bfca86 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -935,7 +935,6 @@ void iFEpiipV(x64emu_t *emu, uintptr_t fnc);
 void iFEpilpV(x64emu_t *emu, uintptr_t fnc);
 void iFEpippi(x64emu_t *emu, uintptr_t fnc);
 void iFEpuppp(x64emu_t *emu, uintptr_t fnc);
-void iFEppiLi(x64emu_t *emu, uintptr_t fnc);
 void iFEppppp(x64emu_t *emu, uintptr_t fnc);
 void iFiiiiii(x64emu_t *emu, uintptr_t fnc);
 void iFiiiiip(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped/wrappedbz2.c b/src/wrapped/wrappedbz2.c
index 686d845f..b53ec5ec 100755
--- a/src/wrapped/wrappedbz2.c
+++ b/src/wrapped/wrappedbz2.c
@@ -22,18 +22,7 @@ const char* bz2Name = "libbz2.so.1";
 #define LIBNAME bz2
 static library_t* my_lib = NULL;
 
-typedef int  (*iFp_t)(void*);
-typedef int  (*iFpi_t)(void*, int);
-typedef int  (*iFpii_t)(void*, int, int);
-typedef int  (*iFpiii_t)(void*, int, int, int);
-
-#define SUPER() \
-    GO(BZ2_bzCompressInit, iFpiii_t)    \
-    GO(BZ2_bzCompress, iFpi_t)          \
-    GO(BZ2_bzCompressEnd, iFp_t)        \
-    GO(BZ2_bzDecompressInit, iFpii_t)   \
-    GO(BZ2_bzDecompress, iFp_t)         \
-    GO(BZ2_bzDecompressEnd, iFp_t)
+#include "generated/wrappedbz2types.h"
 
 typedef struct bz2_my_s {
     // functions
diff --git a/src/wrapped/wrappedcrypto.c b/src/wrapped/wrappedcrypto.c
index aad3ec7a..566539e4 100755
--- a/src/wrapped/wrappedcrypto.c
+++ b/src/wrapped/wrappedcrypto.c
@@ -25,30 +25,10 @@ const char* cryptoName = "libcrypto.so.1.0.0";
 
 static library_t* my_lib = NULL;
 
-typedef void        (*vFp_t)        (void*);
-typedef void*       (*pFp_t)        (void*);
-typedef void        (*vFpp_t)       (void*, void*);
-typedef void*       (*pFpppp_t)     (void*, void*, void*, void*);
-typedef int32_t     (*iFpiipp_t)    (void*, int32_t, int32_t, void*, void*);
-typedef int32_t     (*iFpplppi_t)   (void*, void*, long, void*, void*, int32_t);
-typedef int32_t     (*iFppppipp_t)  (void*, void*, void*, void*, int, void*, void*);
-
-#define SUPER() \
-    GO(ENGINE_ctrl, iFpiipp_t)                      \
-    GO(ENGINE_ctrl_cmd, iFpplppi_t)                 \
-    GO(CRYPTO_set_id_callback, vFp_t)               \
-    GO(CRYPTO_set_locking_callback, vFp_t)          \
-    GO(PEM_read_bio_DSAPrivateKey, pFpppp_t)        \
-    GO(PEM_read_bio_DSA_PUBKEY, pFpppp_t)           \
-    GO(PEM_read_bio_RSAPrivateKey, pFpppp_t)        \
-    GO(PEM_read_bio_RSA_PUBKEY, pFpppp_t)           \
-    GO(PEM_read_bio_ECPrivateKey, pFpppp_t)         \
-    GO(PEM_read_bio_EC_PUBKEY, pFpppp_t)            \
-    GO(PEM_write_bio_DSAPrivateKey, iFppppipp_t)    \
-    GO(PEM_write_bio_RSAPrivateKey, iFppppipp_t)    \
-    GO(PEM_write_bio_ECPrivateKey, iFppppipp_t)     \
-    GO(sk_new, pFp_t)                               \
-    GO(sk_pop_free, vFpp_t)
+typedef int64_t (*iFpplppi_t) (void*, void*, long, void*, void*, int64_t);
+#define ADDED_FUNCTIONS() \
+    GO(ENGINE_ctrl_cmd, iFpplppi_t)
+#include "generated/wrappedcryptotypes.h"
 
 typedef struct crypto_my_s {
     // functions
diff --git a/src/wrapped/wrappedcurl.c b/src/wrapped/wrappedcurl.c
index e7955c1b..59b72b35 100755
--- a/src/wrapped/wrappedcurl.c
+++ b/src/wrapped/wrappedcurl.c
@@ -22,12 +22,7 @@ const char* curlName = "libcurl.so.4";
 
 static library_t* my_lib = NULL;
 
-typedef uint32_t (*uFpup_t)(void*, uint32_t, void*);
-typedef void (*vFp_t)(void*);
-typedef void* (*pFp_t)(void*);
-
-#define SUPER() \
-    GO(curl_easy_setopt, uFpup_t)
+#include "generated/wrappedcurltypes.h"
 
 typedef struct curl_my_s {
     // functions
diff --git a/src/wrapped/wrappeddbus.c b/src/wrapped/wrappeddbus.c
index 643d15a9..dacae925 100755
--- a/src/wrapped/wrappeddbus.c
+++ b/src/wrapped/wrappeddbus.c
@@ -23,31 +23,7 @@ const char* dbusName = "libdbus-1.so.3";
 #define LIBNAME dbus
 static library_t* my_lib = NULL;
 
-typedef void (*vFppp_t)(void*, void*, void*);
-typedef void (*vFpppp_t)(void*, void*, void*, void*);
-typedef int32_t (*iFpppp_t)(void*, void*, void*, void*);
-typedef int32_t (*iFppiA_t)(void*, void*, int32_t, va_list);
-typedef int32_t (*iFpipp_t)(void*, int32_t, void*, void*);
-typedef int32_t (*iFppppp_t)(void*, void*, void*, void*, void*);
-typedef int32_t (*iFpppppp_t)(void*, void*, void*, void*, void*, void*);
-
-#define SUPER()                                                 \
-    GO(dbus_timeout_set_data, vFppp_t)                          \
-    GO(dbus_connection_set_timeout_functions, iFpppppp_t)       \
-    GO(dbus_connection_add_filter, iFpppp_t)                    \
-    GO(dbus_connection_remove_filter, vFppp_t)                  \
-    GO(dbus_message_get_args_valist, iFppiA_t)                  \
-    GO(dbus_message_set_data, iFpipp_t)                         \
-    GO(dbus_pending_call_set_notify, iFpppp_t)                  \
-    GO(dbus_pending_call_set_data, iFpipp_t)                    \
-    GO(dbus_watch_set_data, vFppp_t)                            \
-    GO(dbus_connection_set_dispatch_status_function, vFpppp_t)  \
-    GO(dbus_connection_set_watch_functions, iFpppppp_t)         \
-    GO(dbus_connection_try_register_object_path, iFppppp_t)     \
-    GO(dbus_connection_set_data, iFpipp_t)                      \
-    GO(dbus_connection_set_wakeup_main_function, vFpppp_t)      \
-    GO(dbus_connection_try_register_fallback, iFppppp_t)        \
-
+#include "generated/wrappeddbustypes.h"
 
 typedef struct dbus_my_s {
     // functions
diff --git a/src/wrapped/wrappedfontconfig.c b/src/wrapped/wrappedfontconfig.c
index 5481fef7..7a7a66bd 100755
--- a/src/wrapped/wrappedfontconfig.c
+++ b/src/wrapped/wrappedfontconfig.c
@@ -21,37 +21,4 @@
 const char* fontconfigName = "libfontconfig.so.1";
 #define LIBNAME fontconfig
 
-#define SUPER() \
-
-typedef struct fontconfig_my_s {
-    // functions
-    #define GO(A, B)    B   A;
-    SUPER()
-    #undef GO
-} fontconfig_my_t;
-
-void* getFontconfigMy(library_t* lib)
-{
-    fontconfig_my_t* my = (fontconfig_my_t*)calloc(1, sizeof(fontconfig_my_t));
-    #define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A);
-    (void)lib; // So many wrapping here
-    SUPER()
-    #undef GO
-    return my;
-}
-#undef SUPER
-
-void freeFontconfigMy(void* lib)
-{
-    (void)lib;
-    //fontconfig_my_t *my = (fontconfig_my_t *)lib;
-}
-
-#define CUSTOM_INIT \
-    lib->priv.w.p2 = getFontconfigMy(lib);
-
-#define CUSTOM_FINI \
-    freeFontconfigMy(lib->priv.w.p2); \
-    free(lib->priv.w.p2);
-
 #include "wrappedlib_init.h"
diff --git a/src/wrapped/wrappedfontconfig_private.h b/src/wrapped/wrappedfontconfig_private.h
index 45298e5c..508adb04 100755
--- a/src/wrapped/wrappedfontconfig_private.h
+++ b/src/wrapped/wrappedfontconfig_private.h
@@ -141,7 +141,7 @@ GO(FcPatternAddInteger, iFppi)
 GO(FcPatternAddLangSet, iFppp)
 GO(FcPatternAddMatrix, iFppp)
 GO(FcPatternAddString, iFppp)
-GO(FcPatternAddWeak, iFEppiLi)
+GO(FcPatternAddWeak, iFppiLi)
 //GO2(FcPatternBuild, pFpV, FcPatternVaBuild)
 GO(FcPatternCreate, pFv)
 GO(FcPatternDel, iFpp)
diff --git a/src/wrapped/wrappedgnutls.c b/src/wrapped/wrappedgnutls.c
index 5ee86f8a..ee446c20 100755
--- a/src/wrapped/wrappedgnutls.c
+++ b/src/wrapped/wrappedgnutls.c
@@ -23,13 +23,7 @@ const char* gnutlsName = "libgnutls.so.30";
 
 static library_t *my_lib = NULL;
 
-typedef void        (*vFp_t)        (void*);
-typedef void        (*vFpp_t)       (void*, void*);
-
-#define SUPER() \
-    GO(gnutls_global_set_log_function, vFp_t)       \
-    GO(gnutls_transport_set_pull_function, vFpp_t)  \
-    GO(gnutls_transport_set_push_function, vFpp_t)  \
+#include "generated/wrappedgnutlstypes.h"
 
 typedef struct gnutls_my_s {
     // functions
diff --git a/src/wrapped/wrappedldlinux_private.h b/src/wrapped/wrappedldlinux_private.h
index e3bd935b..45e234db 100755
--- a/src/wrapped/wrappedldlinux_private.h
+++ b/src/wrapped/wrappedldlinux_private.h
@@ -1,4 +1,6 @@
-#if defined(GO) && defined(GOM) && defined(GO2) && defined(DATA)
+#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
+#error meh!
+#endif
 
 // _dl_allocate_tls
 // _dl_allocate_tls_init
@@ -18,7 +20,5 @@ DATA(__pointer_chk_guard, sizeof(void*))
 DATA(_rtld_global, sizeof(void*))
 DATA(_rtld_global_ro, sizeof(void*))
 DATA(__stack_chk_guard, sizeof(void*))
-// defini dans glibc/sysdeps/i386/dl-tls.h
+// defined in glibc/sysdeps/i386/dl-tls.h
 GOM(__tls_get_addr, pFEp)
-
-#endif
\ No newline at end of file
diff --git a/src/wrapped/wrappedlibasound.c b/src/wrapped/wrappedlibasound.c
index 13885062..455d6e4f 100755
--- a/src/wrapped/wrappedlibasound.c
+++ b/src/wrapped/wrappedlibasound.c
@@ -22,22 +22,7 @@
 #define LIBNAME libasound
 const char* libasoundName = "libasound.so.2";
 
-typedef int     (*iFp_t)        (void*);
-typedef void*   (*pFp_t)        (void*);
-typedef int     (*iFpipp_t)     (void*, int, void*, void*);
-typedef int     (*iFpppp_t)     (void*, void*, void*, void*);
-
-EXPORT uintptr_t my_snd_lib_error = 0;
-static void default_error_handler(const char *file, int line, const char *function, int err, const char *fmt, va_list ap)
-{
-    (void)file; (void)line; (void)function; (void)err;
-    vprintf(fmt, ap);
-}
-
-#define SUPER() \
-    GO(snd_async_add_handler, iFpipp_t)                 \
-    GO(snd_async_add_pcm_handler, iFpppp_t)             \
-    GO(snd_lib_error_set_handler, iFp_t)
+#include "generated/wrappedlibasoundtypes.h"
 
 typedef struct asound_my_s {
     // functions
@@ -46,6 +31,13 @@ typedef struct asound_my_s {
     #undef GO
 } asound_my_t;
 
+EXPORT uintptr_t my_snd_lib_error = 0;
+static void default_error_handler(const char *file, int line, const char *function, int err, const char *fmt, va_list ap)
+{
+    (void)file; (void)line; (void)function; (void)err;
+    vprintf(fmt, ap);
+}
+
 void* getAsoundMy(library_t* lib)
 {
     asound_my_t* my = (asound_my_t*)calloc(1, sizeof(asound_my_t));
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 005f94df..3cd8a75b 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -235,6 +235,7 @@ static void* findgloberrFct(void* fct)
     printf_log(LOG_NONE, "Warning, no more slot for libc globerr callback\n");
     return NULL;
 }
+
 #if 0
 #undef dirent
 // filter_dir
@@ -284,6 +285,7 @@ static void* findcompare_dirFct(void* fct)
     return NULL;
 }
 #endif
+
 // filter64
 #define GO(A)   \
 static uintptr_t my_filter64_fct_##A = 0;                               \
@@ -604,11 +606,13 @@ EXPORT int my___wprintf_chk(x64emu_t *emu, int flag, void* fmt, void* b, va_list
     #endif
 }
 #endif
+
 EXPORT int my_fwprintf(x64emu_t *emu, void* F, void* fmt, void* b)  {
     myStackAlignW(emu, (const char*)fmt, b, emu->scratch, R_EAX, 2);
     PREPARE_VALIST;
     return vfwprintf(F, fmt, VARARGS);
 }
+
 #if 0
 EXPORT int my___fwprintf_chk(x64emu_t *emu, void* F, void* fmt, void* b, va_list V) __attribute__((alias("my_fwprintf")));
 
@@ -641,6 +645,7 @@ EXPORT void *my_div(void *result, int numerator, int denominator) {
     return result;
 }
 #endif
+
 EXPORT int my_snprintf(x64emu_t* emu, void* buff, size_t s, void * fmt, uint64_t * b) {
     myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 3);
     PREPARE_VALIST;
@@ -668,6 +673,7 @@ EXPORT int my___sprintf_chk(x64emu_t* emu, void* buff, int flag, size_t l, void
     PREPARE_VALIST;
     return vsprintf(buff, (const char*)fmt, VARARGS);
 }
+
 #if 0
 EXPORT int my_asprintf(x64emu_t* emu, void** buff, void * fmt, void * b, va_list V) {
     #ifndef NOALIGN
@@ -720,8 +726,8 @@ EXPORT int my_sscanf(x64emu_t* emu, void* stream, void* fmt, uint64_t* b)
 }
 EXPORT int my__IO_vfscanf(x64emu_t* emu, void* stream, void* fmt, void* b) __attribute__((alias("my_vfscanf")));
 EXPORT int my___isoc99_vsscanf(x64emu_t* emu, void* stream, void* fmt, void* b) __attribute__((alias("my_vsscanf")));
-#if 0
 
+#if 0
 EXPORT int my___isoc99_vfscanf(x64emu_t* emu, void* stream, void* fmt, void* b) __attribute__((alias("my_vfscanf")));
 #endif
 EXPORT int my___isoc99_fscanf(x64emu_t* emu, void* stream, void* fmt, uint64_t* b)
@@ -802,6 +808,7 @@ EXPORT int my_swscanf(x64emu_t* emu, void* stream, void* fmt, uint64_t* b)
 
     return vswscanf(stream, fmt, VARARGS);
 }
+
 #if 0
 EXPORT void my_verr(x64emu_t* emu, int eval, void* fmt, void* b) {
     #ifndef NOALIGN
@@ -827,6 +834,7 @@ EXPORT void my_vwarn(x64emu_t* emu, void* fmt, void* b) {
     #endif
 }
 #endif
+
 EXPORT void my_syslog(x64emu_t* emu, int priority, const char* fmt, uint64_t* b)
 {
     myStackAlign(emu, fmt, b, emu->scratch, R_EAX, 2);
@@ -970,6 +978,7 @@ EXPORT int my__IO_file_stat(x64emu_t* emu, void* f, void* buf)
     UnalignStat64(&st, buf);
     return r;
 }
+
 #if 0
 EXPORT int my_fstatfs64(int fd, void* buf)
 {
@@ -1033,9 +1042,8 @@ EXPORT void* my_fts_open(x64emu_t* emu, void* path, int options, void* c)
     (void)emu;
     return fts_open(path, options, findcompareFct(c));
 }
-#if 0
-
 
+#if 0
 struct i386_dirent {
     uint32_t d_ino;
     int32_t  d_off;
@@ -1416,7 +1424,6 @@ EXPORT FILE* my_fopen64(x64emu_t* emu, const char* path, const char* mode)
     return fopen64(path, mode);
 }
 
-
 #if 0
 EXPORT int32_t my_ftw(x64emu_t* emu, void* pathname, void* B, int32_t nopenfd)
 {
@@ -1448,6 +1455,7 @@ EXPORT void* my_ldiv(x64emu_t* emu, void* p, int32_t num, int32_t den)
     return p;
 }
 #endif
+
 #ifndef NOALIGN
 EXPORT int32_t my_epoll_ctl(x64emu_t* emu, int32_t epfd, int32_t op, int32_t fd, void* event)
 {
@@ -1602,6 +1610,7 @@ EXPORT int32_t my_execlp(x64emu_t* emu, const char* path)
     free(newargv);
     return ret;
 }
+
 #if 0
 // execvp should use PATH to search for the program first
 EXPORT int32_t my_posix_spawnp(x64emu_t* emu, pid_t* pid, const char* path, 
@@ -1633,6 +1642,7 @@ EXPORT int32_t my_posix_spawnp(x64emu_t* emu, pid_t* pid, const char* path,
     return posix_spawnp(pid, path, actions, attrp, argv, envp);
 }
 #endif
+
 EXPORT void my__Jv_RegisterClasses() {}
 
 EXPORT int32_t my___cxa_thread_atexit_impl(x64emu_t* emu, void* dtor, void* obj, void* dso)
@@ -1656,6 +1666,7 @@ EXPORT int32_t my___register_atfork(x64emu_t *emu, void* prepare, void* parent,
     my_context->atforks[my_context->atfork_sz].handle = handle;
     return 0;
 }
+
 #if 0
 EXPORT uint64_t my___umoddi3(uint64_t a, uint64_t b)
 {
@@ -1675,6 +1686,7 @@ EXPORT int32_t my___poll_chk(void* a, uint32_t b, int c, int l)
     return poll(a, b, c);   // no check...
 }
 #endif
+
 EXPORT int32_t my_fcntl64(x64emu_t* emu, int32_t a, int32_t b, void* c)
 {
     (void)emu;
@@ -1728,6 +1740,7 @@ EXPORT int32_t my_fcntl(x64emu_t* emu, int32_t a, int32_t b, void* c)
     return ret;    
 }
 EXPORT int32_t my___fcntl(x64emu_t* emu, int32_t a, int32_t b, void* c) __attribute__((alias("my_fcntl")));
+
 #if 0
 EXPORT int32_t my_preadv64(x64emu_t* emu, int32_t fd, void* v, int32_t c, int64_t o)
 {
@@ -1807,6 +1820,7 @@ void InitCpuModel()
                                      | (1<<FEATURE_ADX);
 }
 #endif
+
 EXPORT const unsigned short int *my___ctype_b;
 EXPORT const int32_t *my___ctype_tolower;
 EXPORT const int32_t *my___ctype_toupper;
@@ -2046,6 +2060,7 @@ EXPORT int my_mprotect(x64emu_t* emu, void *addr, unsigned long len, int prot)
         updateProtection((uintptr_t)addr, len, prot);
     return ret;
 }
+
 #if 0
 typedef struct my_cookie_s {
     uintptr_t r, w, s, c;
@@ -2150,10 +2165,12 @@ EXPORT int my_nanosleep(const struct timespec *req, struct timespec *rem)
     return nanosleep(req, rem);
 }
 #endif
+
 EXPORT void* my_malloc(unsigned long size)
 {
     return calloc(1, size);
 }
+
 #if 0
 #ifdef PANDORA
 #define RENAME_NOREPLACE	(1 << 0)
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index 89f70935..607b5a5a 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -446,7 +446,7 @@ GOW(ftrylockfile, iFp)
 //GOW(fts64_set, 
 GO(fts_children, pFpi)
 GO(fts_close, iFp)
-GO(fts_open, pFEpip)
+GOM(fts_open, pFEpip)
 GO(fts_read, pFp)
 GO(fts_set, iFppi)
 GOM(ftw, iFEppi)
@@ -923,7 +923,7 @@ GOM(__isoc99_sscanf, iFEppV)
 //GO(__isoc99_vfscanf, 
 //GO(__isoc99_vfwscanf, 
 //GO(__isoc99_vscanf, 
-GO(__isoc99_vsscanf, iFEppp)
+GOM(__isoc99_vsscanf, iFEppp)
 //GO(__isoc99_vswscanf, 
 //GO(__isoc99_vwscanf, 
 //GO(__isoc99_wscanf, 
diff --git a/src/wrapped/wrappedlibgl.c b/src/wrapped/wrappedlibgl.c
index 8f544a3c..27ef1966 100755
--- a/src/wrapped/wrappedlibgl.c
+++ b/src/wrapped/wrappedlibgl.c
@@ -21,6 +21,8 @@ extern char* libGL;
 const char* libglName = "libGL.so.1";
 #define LIBNAME libgl
 
+// FIXME: old wrapped* type of file, cannot use generated/wrappedlibgltypes.h
+
 void fillGLProcWrapper(box64context_t*);
 void freeProcWrapper(kh_symbolmap_t** symbolmap);
 
diff --git a/src/wrapped/wrappedlibglu.c b/src/wrapped/wrappedlibglu.c
index afab9a21..817b4e5c 100755
--- a/src/wrapped/wrappedlibglu.c
+++ b/src/wrapped/wrappedlibglu.c
@@ -18,14 +18,10 @@
 #include "emu/x64emu_private.h"
 #include "myalign.h"
 
-typedef void        (*vFpip_t)(void*, int32_t, void*);
-
-static library_t* my_lib = NULL;
+const char* libgluName = "libGLU.so.1";
+#define LIBNAME libglu
 
-#define SUPER() \
-    GO(gluQuadricCallback, vFpip_t) \
-    GO(gluTessCallback, vFpip_t)   \
-    GO(gluNurbsCallback, vFpip_t)
+#include "generated/wrappedlibglutypes.h"
 
 typedef struct libglu_my_s {
     // functions
@@ -138,13 +134,13 @@ static void* findglu_callback5Fct(void* fct)
 void EXPORT my_gluQuadricCallback(x64emu_t* emu, void* a, int32_t b, void* cb)
 {
     (void)emu;
-    libglu_my_t *my = (libglu_my_t*)my_lib->priv.w.p2;
+    libglu_my_t *my = (libglu_my_t*)emu->context->libglu->priv.w.p2;
     my->gluQuadricCallback(a, b, findglu_callbackFct(cb));
 }
 void EXPORT my_gluTessCallback(x64emu_t* emu, void* a, int32_t b, void* cb)
 {
     (void)emu;
-    libglu_my_t *my = (libglu_my_t*)my_lib->priv.w.p2;
+    libglu_my_t *my = (libglu_my_t*)emu->context->libglu->priv.w.p2;
     if(b==GLU_TESS_COMBINE)
         my->gluTessCallback(a, b, findglu_callback4Fct(cb));
     else if(b==GLU_TESS_COMBINE_DATA)
@@ -155,15 +151,12 @@ void EXPORT my_gluTessCallback(x64emu_t* emu, void* a, int32_t b, void* cb)
 void EXPORT my_gluNurbsCallback(x64emu_t* emu, void* a, int32_t b, void* cb)
 {
     (void)emu;
-    libglu_my_t *my = (libglu_my_t*)my_lib->priv.w.p2;
+    libglu_my_t *my = (libglu_my_t*)emu->context->libglu->priv.w.p2;
     my->gluNurbsCallback(a, b, findglu_callbackFct(cb));
 }
 
-const char* libgluName = "libGLU.so.1";
-#define LIBNAME libglu
-
 #define CUSTOM_INIT                     \
-    my_lib = lib;                       \
+    box64->libglu = lib;                \
     lib->priv.w.p2 = getGLUMy(lib);     \
     lib->priv.w.needed = 1;             \
     lib->priv.w.neededlibs = (char**)calloc(lib->priv.w.needed, sizeof(char*)); \
@@ -171,8 +164,7 @@ const char* libgluName = "libGLU.so.1";
 
 #define CUSTOM_FINI             \
     freeGLUMy(lib->priv.w.p2);  \
-    free(lib->priv.w.p2);       \
-    my_lib = NULL;
+    free(lib->priv.w.p2);
 
 
 #include "wrappedlib_init.h"
diff --git a/src/wrapped/wrappedlibsm.c b/src/wrapped/wrappedlibsm.c
index 06891111..ef9c81bc 100755
--- a/src/wrapped/wrappedlibsm.c
+++ b/src/wrapped/wrappedlibsm.c
@@ -21,14 +21,7 @@
 const char* libsmName = "libSM.so.6";
 #define LIBNAME libsm
 
-typedef int     (*iFppp_t)          (void*, void*, void*);
-typedef int     (*iFpipp_t)         (void*, int, void*, void*);
-typedef void*   (*pFppiiLpppip_t)   (void*, void*, int, int, unsigned long, void*, void*, void*, int, void*);
-
-#define SUPER() \
-    GO(SmcOpenConnection, pFppiiLpppip_t)   \
-    GO(SmcInteractRequest, iFpipp_t)        \
-    GO(SmcRequestSaveYourselfPhase2, iFppp_t)
+#include "generated/wrappedlibsmtypes.h"
 
 typedef struct libsm_my_s {
     // functions
diff --git a/src/wrapped/wrappedlibssl.c b/src/wrapped/wrappedlibssl.c
index 9d3c9b5d..8a9fd7a0 100755
--- a/src/wrapped/wrappedlibssl.c
+++ b/src/wrapped/wrappedlibssl.c
@@ -24,21 +24,7 @@ const char* libsslName = "libssl.so.1.0.0";
 
 static library_t* my_lib = NULL;
 
-typedef void    (*vFpp_t)       (void*, void*);
-typedef void    (*vFpip_t)      (void*, int, void*);
-typedef long    (*lFpip_t)      (void*, int, void*);
-typedef void    (*vFppp_t)      (void*, void*, void*);
-typedef int     (*iFlpppp_t)    (long, void*, void*, void*, void*);
-
-#define SUPER() \
-    GO(SSL_CTX_set_default_passwd_cb, vFpp_t)       \
-    GO(SSL_CTX_callback_ctrl, lFpip_t)              \
-    GO(SSL_CTX_set_verify, vFpip_t)                 \
-    GO(SSL_set_verify, vFpip_t)                     \
-    GO(SSL_callback_ctrl, lFpip_t)                  \
-    GO(SSL_get_ex_new_index, iFlpppp_t)             \
-    GO(SSL_set_psk_client_callback, vFpp_t)         \
-    GO(SSL_CTX_set_next_proto_select_cb, vFppp_t)   \
+#include "generated/wrappedlibssltypes.h"
 
 typedef struct libssl_my_s {
     // functions
diff --git a/src/wrapped/wrappedlibtinfo.c b/src/wrapped/wrappedlibtinfo.c
index 06393291..9d10d0b1 100755
--- a/src/wrapped/wrappedlibtinfo.c
+++ b/src/wrapped/wrappedlibtinfo.c
@@ -23,10 +23,7 @@ const char* libtinfoName = "libtinfo.so.5";
 
 static library_t* my_lib = NULL;
 
-typedef int    (*iFpip_t)       (void*, int, void*);
-
-#define SUPER() \
-    GO(tputs, iFpip_t)       \
+#include "generated/wrappedlibtinfotypes.h"
 
 typedef struct libtinfo_my_s {
     // functions
diff --git a/src/wrapped/wrappedlibtinfo6.c b/src/wrapped/wrappedlibtinfo6.c
index 2b4bd8c0..af7254ff 100755
--- a/src/wrapped/wrappedlibtinfo6.c
+++ b/src/wrapped/wrappedlibtinfo6.c
@@ -23,10 +23,7 @@ const char* libtinfo6Name = "libtinfo.so.6";
 
 static library_t* my_lib = NULL;
 
-typedef int    (*iFpip_t)       (void*, int, void*);
-
-#define SUPER() \
-    GO(tputs, iFpip_t)       \
+#include "generated/wrappedlibtinfo6types.h"
 
 typedef struct libtinfo6_my_s {
     // functions
diff --git a/src/wrapped/wrappedlibx11.c b/src/wrapped/wrappedlibx11.c
index e0a8d43f..6f2fc1ee 100755
--- a/src/wrapped/wrappedlibx11.c
+++ b/src/wrapped/wrappedlibx11.c
@@ -45,15 +45,15 @@ typedef struct ximage_s {
     void*(*create_image)(
             void*           /* display */,
             void*           /* visual */,
-            uint32_t        /* depth */,
-            int32_t         /* format */,
-            int32_t         /* offset */,
+            uint64_t        /* depth */,            // Should be uint32_t instead
+            int64_t         /* format */,           // Should be int32_t instead
+            int64_t         /* offset */,           // Should be int32_t instead
             void*           /* data */,
-            uint32_t        /* width */,
-            uint32_t        /* height */,
-            int32_t         /* bitmap_pad */,
-            int32_t         /* bytes_per_line */);
-    int32_t (*destroy_image)        (void*);
+            uint64_t        /* width */,            // Should be uint32_t instead
+            uint64_t        /* height */,           // Should be uint32_t instead
+            int64_t         /* bitmap_pad */,       // Should be int32_t instead
+            int64_t         /* bytes_per_line */);  // Should be int32_t instead
+    int64_t (*destroy_image)        (void*);        // Should be int32_t instead
     uintptr_t (*get_pixel)           (void*, int32_t, int32_t);
     int32_t (*put_pixel)            (void*, int32_t, int32_t, uintptr_t);
     void*(*sub_image)    (void*, int32_t, int32_t, uint32_t, uint32_t); //sub_image return a new XImage that need bridging => custom wrapper
@@ -80,62 +80,15 @@ typedef struct _XImage {
 } XImage;
 
 typedef uint32_t (*uFv_t)(void);
-typedef void (*vFp_t)(void*);
-typedef void* (*pFp_t)(void*);
-typedef void (*vFpp_t)(void*, void*);
-typedef void* (*pFpp_t)(void*, void*);
-typedef void* (*pFpi_t)(void*, int32_t);
-typedef void* (*pFpip_t)(void*, int32_t, void*);
-typedef int32_t (*iFp_t)(void*);
-typedef int32_t (*iFpi_t)(void*, int32_t);
 typedef int32_t (*iFpl_t)(void*, intptr_t);
-typedef int32_t (*iFppp_t)(void*, void*, void*);
-typedef int32_t (*iFppu_t)(void*, void*, uint32_t);
-typedef int32_t (*iFpppp_t)(void*, void*, void*, void*);
-typedef uint32_t (*uFpii_t)(void*, int32_t, int32_t);
 typedef uintptr_t (*LFpii_t)(void*, int32_t, int32_t);
-typedef int32_t (*iFpiiu_t)(void*, int32_t, int32_t, uint32_t);
 typedef int32_t (*iFpiiL_t)(void*, int32_t, int32_t, uintptr_t);
-typedef void* (*pFppup_t)(void*, void*, uint32_t, void*);
 typedef void* (*pFpiiuu_t)(void*, int32_t, int32_t, uint32_t, uint32_t);
-typedef void* (*pFppiiuuui_t)(void*, void*, int32_t, int32_t, uint32_t, uint32_t, uint32_t, int32_t);
-typedef void* (*pFppuiipuuii_t)(void*, void*, uint32_t, int32_t, int32_t, void*, uint32_t, uint32_t, int32_t, int32_t);
-typedef void* (*pFppiiuuuipii_t)(void*, void*, int32_t, int32_t, uint32_t, uint32_t, uint32_t, int32_t, void*, int32_t, int32_t);
-typedef int32_t (*iFppppiiiiuu_t)(void*, void*, void*, void*, int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t);
-typedef int (*iFppppp_t)(void*, void*, void*, void*, void*);
-typedef int (*iFpppppp_t)(void*, void*, void*, void*, void*, void*);
 
-#define SUPER() \
-    GO(XSetErrorHandler, pFp_t)             \
-    GO(XSetIOErrorHandler, pFp_t)           \
-    GO(XESetError, pFpip_t)                 \
-    GO(XESetCloseDisplay, pFpip_t)          \
-    GO(XIfEvent, iFpppp_t)                  \
-    GO(XCheckIfEvent, iFpppp_t)             \
-    GO(XPeekIfEvent, iFpppp_t)              \
-    GO(XCreateImage, pFppuiipuuii_t)        \
-    GO(XInitImage, iFp_t)                   \
-    GO(XGetImage, pFppiiuuui_t)             \
-    GO(XPutImage, iFppppiiiiuu_t)           \
-    GO(XGetSubImage, pFppiiuuuipii_t)       \
-    GO(XDestroyImage, vFp_t)                \
-    GO(_XDeqAsyncHandler, vFpp_t)           \
-    GO(XLoadQueryFont, pFpp_t)              \
-    GO(XCreateGC, pFppup_t)                 \
-    GO(XSetBackground, iFppu_t)             \
-    GO(XSetForeground, iFppu_t)             \
-    GO(XESetWireToEvent, pFpip_t)           \
-    GO(XESetEventToWire, pFpip_t)           \
-    GO(XCloseDisplay, iFp_t)                \
-    GO(XOpenDisplay, pFp_t)                 \
-    GO(XInitThreads, uFv_t)                 \
-    GO(XRegisterIMInstantiateCallback, iFpppppp_t)      \
-    GO(XUnregisterIMInstantiateCallback, iFpppppp_t)    \
-    GO(XQueryExtension, iFppppp_t)          \
-    GO(XAddConnectionWatch, iFppp_t)        \
-    GO(XRemoveConnectionWatch, iFppp_t)     \
-    GO(XSetAfterFunction, pFpp_t)           \
-    GO(XSynchronize, pFpi_t)                \
+#define ADDED_FUNCTIONS() \
+    GO(XInitThreads, uFv_t)
+
+#include "generated/wrappedlibx11types.h"
 
 typedef struct x11_my_s {
     // functions
diff --git a/src/wrapped/wrappedlibx11_private.h b/src/wrapped/wrappedlibx11_private.h
index ca29ac04..42a6407b 100755
--- a/src/wrapped/wrappedlibx11_private.h
+++ b/src/wrapped/wrappedlibx11_private.h
@@ -259,7 +259,7 @@ GO(XDeleteContext, iFppp)
 //GO(XDeleteModifiermapEntry
 GO(XDeleteProperty, iFppp)
 // _XDeq
-GO(_XDeqAsyncHandler, vFEpp)
+GOM(_XDeqAsyncHandler, vFEpp)
 GO(XDestroyIC, vFp)
 GOM(XDestroyImage, iFEp)  //need to unbridge
 //GO(XDestroyOC
diff --git a/src/wrapped/wrappedlibxext.c b/src/wrapped/wrappedlibxext.c
index 63182f2f..23d523bf 100755
--- a/src/wrapped/wrappedlibxext.c
+++ b/src/wrapped/wrappedlibxext.c
@@ -41,30 +41,20 @@ typedef struct my_XExtensionHooks {
 } my_XExtensionHooks;
 
 
-typedef void* (*pFp_t)(void*);
-typedef int32_t (*iFpppiiu_t)(void*, void*, void*, int32_t, int32_t, uint32_t);
-typedef int32_t (*pFppppip_t)(void*, void*, void*, void*, int32_t, void*);
-typedef void* (*pFppuippuu_t)(void*, void*, uint32_t, int32_t, void*, void*, uint32_t, uint32_t);
-typedef int32_t (*iFppppiiiiuui_t)(void*, void*, void*, void*, int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, int32_t);
+#include "generated/wrappedlibxexttypes.h"
 
 typedef struct xext_my_s {
     // functions
-    pFppuippuu_t        XShmCreateImage;
-    iFpppiiu_t          XShmGetImage;
-    iFppppiiiiuui_t     XShmPutImage;
-    pFp_t               XSetExtensionErrorHandler;
-    pFppppip_t          XextAddDisplay;
+    #define GO(A, B)    B   A;
+    SUPER()
+    #undef GO
 } xext_my_t;
 
 void* getXextMy(library_t* lib)
 {
     xext_my_t* my = (xext_my_t*)calloc(1, sizeof(xext_my_t));
     #define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A);
-    GO(XShmCreateImage, pFppuippuu_t)
-    GO(XShmGetImage, iFpppiiu_t)
-    GO(XShmPutImage, iFppppiiiiuui_t)
-    GO(XSetExtensionErrorHandler, pFp_t)
-    GO(XextAddDisplay, pFppppip_t)
+    SUPER()
     #undef GO
     return my;
 }
@@ -74,6 +64,7 @@ void freeXextMy(void* lib)
     (void)lib;
     //xext_my_t *my = (xext_my_t *)lib;
 }
+#undef SUPER
 
 #define SUPER() \
 GO(0)   \
@@ -229,7 +220,7 @@ static char* my_hook_error_string(void* a, int b, void* c, void* d, int e) {
     return 0;
 }
 
-EXPORT int32_t my_XextAddDisplay(x64emu_t* emu, void* extinfo, void* dpy, void* extname, my_XExtensionHooks* hooks, int nevents, void* data)
+EXPORT void* my_XextAddDisplay(x64emu_t* emu, void* extinfo, void* dpy, void* extname, my_XExtensionHooks* hooks, int nevents, void* data)
 {
     xext_my_t *my = (xext_my_t*)my_lib->priv.w.p2;
 
@@ -250,7 +241,7 @@ EXPORT int32_t my_XextAddDisplay(x64emu_t* emu, void* extinfo, void* dpy, void*
     GO(error)
     GO(error_string)
     #undef GO
-    int32_t ret = my->XextAddDisplay(extinfo, dpy, extname, &natives, nevents, data);
+    void *ret = my->XextAddDisplay(extinfo, dpy, extname, &natives, nevents, data);
     return ret;
 }
 
diff --git a/src/wrapped/wrappedlibxt.c b/src/wrapped/wrappedlibxt.c
index a0802a31..f35265e9 100755
--- a/src/wrapped/wrappedlibxt.c
+++ b/src/wrapped/wrappedlibxt.c
@@ -20,16 +20,13 @@
 const char* libxtName = "libXt.so.6";
 #define LIBNAME libxt
 
-typedef void  (*vFpuipp_t)(void*, uint32_t, int32_t, void*, void*);
-
-#define SUPER() \
-    GO(XtAddEventHandler, vFpuipp_t)
+#include "generated/wrappedlibxttypes.h"
 
 typedef struct libxt_my_s {
+    // functions
     #define GO(A, B)    B   A;
     SUPER()
     #undef GO
-    // functions
 } libxt_my_t;
 
 void* getXtMy(library_t* lib)
diff --git a/src/wrapped/wrappedlibxtst.c b/src/wrapped/wrappedlibxtst.c
index 3c1ed488..df7b14c4 100755
--- a/src/wrapped/wrappedlibxtst.c
+++ b/src/wrapped/wrappedlibxtst.c
@@ -20,11 +20,7 @@
 const char* libxtstName = "libXtst.so.6";
 #define LIBNAME libxtst
 
-typedef int (*iFpppp_t)(void*, void*, void*, void*);
-
-#define SUPER() \
-    GO(XRecordEnableContextAsync, iFpppp_t) \
-    GO(XRecordEnableContext, iFpppp_t)      \
+#include "generated/wrappedlibxtsttypes.h"
 
 typedef struct libxtst_my_s {
     #define GO(A, B)    B   A;
diff --git a/src/wrapped/wrappedopenal.c b/src/wrapped/wrappedopenal.c
index 6aa73f2f..224431ee 100755
--- a/src/wrapped/wrappedopenal.c
+++ b/src/wrapped/wrappedopenal.c
@@ -17,29 +17,25 @@
 #include "librarian.h"
 #include "myalign.h"
 
+const char* openalName = "libopenal.so.1";
+#define LIBNAME openal
+
 static char* libname = NULL;
 
-typedef void* (*pFp_t)(void*);
-typedef void* (*pFpp_t)(void*, void*);
-typedef void (*vFv_t)();
-typedef void (*vFiiipp_t)(int32_t, int32_t, int32_t, void*, void*);
+#include "generated/wrappedopenaltypes.h"
 
 typedef struct openal_my_s {
     // functions
-    pFp_t  alGetProcAddress;
-    pFpp_t  alcGetProcAddress;
-    vFiiipp_t alRequestFoldbackStart;
-    vFv_t alRequestFoldbackStop;
+    #define GO(A, B)    B   A;
+    SUPER()
+    #undef GO
 } openal_my_t;
 
 void* getOpenALMy(library_t* lib)
 {
     openal_my_t* my = (openal_my_t*)calloc(1, sizeof(openal_my_t));
     #define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A);
-    GO(alGetProcAddress, pFp_t)
-    GO(alcGetProcAddress, pFpp_t)
-    GO(alRequestFoldbackStart, vFiiipp_t)
-    GO(alRequestFoldbackStop, vFv_t)
+    SUPER()
     #undef GO
     return my;
 }
@@ -49,6 +45,8 @@ void freeOpenALMy(void* lib)
     (void)lib;
     //openal_my_t *my = (openal_my_t *)lib;
 }
+#undef SUPER
+
 #define SUPER() \
 GO(0)   \
 GO(1)   \
@@ -86,9 +84,6 @@ void* my_alcGetProcAddress(x64emu_t* emu, void* device, void* name);
 void my_alRequestFoldbackStart(x64emu_t *emu, int32_t mode, int32_t count, int32_t length, void* mem, void* cb);
 void my_alRequestFoldbackStop(x64emu_t* emu);
 
-const char* openalName = "libopenal.so.1";
-#define LIBNAME openal
-
 #define CUSTOM_INIT \
     libname = lib->name;                \
     lib->priv.w.p2 = getOpenALMy(lib);
diff --git a/src/wrapped/wrappedpango.c b/src/wrapped/wrappedpango.c
index 0e6569c9..de6a206e 100755
--- a/src/wrapped/wrappedpango.c
+++ b/src/wrapped/wrappedpango.c
@@ -21,10 +21,7 @@ const char* pangoName = "libpango-1.0.so.0";
 #define LIBNAME pango
 static library_t *my_lib = NULL;
 
-typedef void    (*vFpp_t)       (void*, void*);
-
-#define SUPER() \
-    GO(pango_attribute_init, vFpp_t)        \
+#include "generated/wrappedpangotypes.h"
 
 typedef struct pango_my_s {
     // functions
diff --git a/src/wrapped/wrappedpng16.c b/src/wrapped/wrappedpng16.c
index e3220c5e..c537b5a0 100755
--- a/src/wrapped/wrappedpng16.c
+++ b/src/wrapped/wrappedpng16.c
@@ -26,23 +26,7 @@ const char* png16Name =
 	;
 #define LIBNAME png16
 
-typedef void  (*vFpp_t)(void*, void*);
-typedef void  (*vFppp_t)(void*, void*, void*);
-typedef void  (*vFpppp_t)(void*, void*, void*, void*);
-typedef void* (*pFpppp_t)(void*, void*, void*, void*);
-typedef void  (*vFppppp_t)(void*, void*, void*, void*, void*);
-typedef void* (*pFppppppp_t)(void*, void*, void*, void*, void*, void*, void*);
-
-#define SUPER() \
-    GO(png_set_read_fn, vFppp_t)                \
-    GO(png_set_error_fn, vFpppp_t)              \
-    GO(png_set_read_user_transform_fn, vFpp_t)  \
-    GO(png_set_write_fn, vFpppp_t)              \
-    GO(png_create_read_struct_2, pFppppppp_t)   \
-    GO(png_create_write_struct_2, pFppppppp_t)  \
-    GO(png_set_progressive_read_fn, vFppppp_t)  \
-    GO(png_create_read_struct, pFpppp_t)        \
-
+#include "generated/wrappedpng16types.h"
 
 typedef struct png16_my_s {
     #define GO(A, B)    B   A;
diff --git a/src/wrapped/wrappedpulse.c b/src/wrapped/wrappedpulse.c
index f0c9a14a..6be4f1aa 100755
--- a/src/wrapped/wrappedpulse.c
+++ b/src/wrapped/wrappedpulse.c
@@ -20,6 +20,8 @@
 const char* pulseName = "libpulse.so.0";
 #define LIBNAME pulse
 
+// TODO: check my_pa_proplist_setf (not using generated/...)
+
 typedef struct my_pa_mainloop_api_s {
     void*   data;
     void*   io_new;