about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedlibncurses6.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wrapped/wrappedlibncurses6.c')
-rwxr-xr-xsrc/wrapped/wrappedlibncurses6.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/wrapped/wrappedlibncurses6.c b/src/wrapped/wrappedlibncurses6.c
index 3878d159..8d2e3157 100755
--- a/src/wrapped/wrappedlibncurses6.c
+++ b/src/wrapped/wrappedlibncurses6.c
@@ -26,15 +26,8 @@ static library_t* my_lib = NULL;
 
 // this is a simple copy of libncursesw wrapper. TODO: check if ok
 
-typedef void*       (*pFv_t)();
-typedef int         (*iFppV_t)(void*, void*, va_list);
-typedef int         (*iFpiip_t)(void*, int32_t, int32_t, void*);
-
-#define SUPER() \
-    GO(initscr, pFv_t)      \
-    GO(mvwprintw, iFpiip_t) \
-    GO(vwprintw, iFppV_t)   \
-    GO(stdscr, void*)
+#define ADDED_FUNCTIONS() GO(stdscr, void*)
+#include "generated/wrappedlibncurses6types.h"
 
 typedef struct libncurses6_my_s {
     // functions
@@ -90,6 +83,21 @@ EXPORT int my6_vwprintw(x64emu_t* emu, void* p, void* fmt, x64_va_list_t b)
     return my->vwprintw(p, fmt, VARARGS);
 }
 
+EXPORT int my6_mvprintw(x64emu_t* emu, int x, int y, void* fmt, void* b)
+{
+    libncurses6_my_t *my = (libncurses6_my_t*)my_lib->priv.w.p2;
+
+    char* buf = NULL;
+    myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 3);
+    PREPARE_VALIST;
+    int ret = vasprintf(&buf, (const char*)fmt, VARARGS);
+    (void)ret;
+    // pre-bake the fmt/vaarg, because there is no "va_list" version of this function
+    ret = my->mvprintw(x, y, buf);
+    free(buf);
+    return ret;
+}
+
 EXPORT void* my6_initscr()
 {
     libncurses6_my_t *my = (libncurses6_my_t*)my_lib->priv.w.p2;