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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
diff -ru SDL2-2.0.8.orig/include/SDL_stdinc.h SDL2-2.0.8/include/SDL_stdinc.h
--- SDL2-2.0.8.orig/include/SDL_stdinc.h 2018-03-01 17:34:41.000000000 +0100
+++ SDL2-2.0.8/include/SDL_stdinc.h 2020-10-05 12:29:51.927442178 +0200
@@ -451,10 +451,17 @@
extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
+#ifdef __midipix__
+extern DECLSPEC size_t SDLCALL SDL_wcslen(const uint16_t *wstr);
+extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) uint16_t *dst, const uint16_t *src, size_t maxlen);
+extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) uint16_t *dst, const uint16_t *src, size_t maxlen);
+extern DECLSPEC int SDLCALL SDL_wcscmp(const uint16_t *str, const uint16_t *str2);
+#else
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
+#endif /* !__midipix__ */
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
diff -ru SDL2-2.0.8.orig/src/dynapi/SDL_dynapi_procs.h SDL2-2.0.8/src/dynapi/SDL_dynapi_procs.h
--- SDL2-2.0.8.orig/src/dynapi/SDL_dynapi_procs.h 2018-03-01 17:34:42.000000000 +0100
+++ SDL2-2.0.8/src/dynapi/SDL_dynapi_procs.h 2020-10-05 12:41:07.154180772 +0200
@@ -418,9 +418,15 @@
SDL_DYNAPI_PROC(void*,SDL_memcpy,(SDL_OUT_BYTECAP(c) void *a, SDL_IN_BYTECAP(c) const void *b, size_t c),(a,b,c),return)
SDL_DYNAPI_PROC(void*,SDL_memmove,(SDL_OUT_BYTECAP(c) void *a, SDL_IN_BYTECAP(c) const void *b, size_t c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_memcmp,(const void *a, const void *b, size_t c),(a,b,c),return)
+#ifdef __midipix__
+SDL_DYNAPI_PROC(size_t,SDL_wcslen,(const uint16_t *a),(a),return)
+SDL_DYNAPI_PROC(size_t,SDL_wcslcpy,(SDL_OUT_Z_CAP(c) uint16_t *a, const uint16_t *b, size_t c),(a,b,c),return)
+SDL_DYNAPI_PROC(size_t,SDL_wcslcat,(SDL_INOUT_Z_CAP(c) uint16_t *a, const uint16_t *b, size_t c),(a,b,c),return)
+#else
SDL_DYNAPI_PROC(size_t,SDL_wcslen,(const wchar_t *a),(a),return)
SDL_DYNAPI_PROC(size_t,SDL_wcslcpy,(SDL_OUT_Z_CAP(c) wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
SDL_DYNAPI_PROC(size_t,SDL_wcslcat,(SDL_INOUT_Z_CAP(c) wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
+#endif
SDL_DYNAPI_PROC(size_t,SDL_strlen,(const char *a),(a),return)
SDL_DYNAPI_PROC(size_t,SDL_strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return)
SDL_DYNAPI_PROC(size_t,SDL_utf8strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return)
@@ -660,7 +666,11 @@
SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickGetDeviceInstanceID,(int a),(a),return)
SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return)
SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return)
+#ifdef __midipix__
+SDL_DYNAPI_PROC(int,SDL_wcscmp,(const uint16_t *a, const uint16_t *b),(a,b),return)
+#else
SDL_DYNAPI_PROC(int,SDL_wcscmp,(const wchar_t *a, const wchar_t *b),(a,b),return)
+#endif
SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return)
diff -ru SDL2-2.0.8.orig/src/stdlib/SDL_string.c SDL2-2.0.8/src/stdlib/SDL_string.c
--- SDL2-2.0.8.orig/src/stdlib/SDL_string.c 2018-03-01 17:34:42.000000000 +0100
+++ SDL2-2.0.8/src/stdlib/SDL_string.c 2020-10-05 12:29:39.691442561 +0200
@@ -416,6 +416,44 @@
#endif /* HAVE_STRLEN */
}
+#ifdef __midipix__
+#include <u16ports/u16ports.h>
+
+size_t
+SDL_wcslen(const uint16_t * string)
+{
+ return u16_wcslen(string);
+}
+
+size_t
+SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) uint16_t *dst, const uint16_t *src, size_t maxlen)
+{
+ size_t srclen = u16_wcslen(src);
+ if(maxlen > 0) {
+ size_t len = SDL_min(srclen, maxlen - 1);
+ SDL_memcpy(dst, src, len * sizeof(uint16_t));
+ dst[len] = '\0';
+ }
+ return srclen;
+}
+
+size_t
+SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) uint16_t *dst, const uint16_t *src, size_t maxlen)
+{
+ size_t dstlen = u16_wcslen(dst);
+ size_t srclen = u16_wcslen(src);
+ if (dstlen < maxlen) {
+ SDL_wcslcpy(dst + dstlen, src, maxlen - dstlen);
+ }
+ return dstlen + srclen;
+}
+
+int
+SDL_wcscmp(const uint16_t *str1, const uint16_t *str2)
+{
+ return u16_wcscmp(str1, str2);
+}
+#else
size_t
SDL_wcslen(const wchar_t * string)
{
@@ -476,6 +514,7 @@
return (int)(*str1 - *str2);
#endif /* HAVE_WCSCMP */
}
+#endif /* !__midipix__ */
size_t
SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
diff -ru SDL2-2.0.8.orig/src/video/windows/SDL_windowsmessagebox.c SDL2-2.0.8/src/video/windows/SDL_windowsmessagebox.c
--- SDL2-2.0.8.orig/src/video/windows/SDL_windowsmessagebox.c 2018-03-01 17:34:42.000000000 +0100
+++ SDL2-2.0.8/src/video/windows/SDL_windowsmessagebox.c 2020-10-05 12:51:31.389436939 +0200
@@ -350,7 +350,11 @@
HFONT DialogFont;
SIZE Size;
RECT TextSize;
+#ifdef __midipix__
+ uint16_t *wmessage;
+#else
wchar_t* wmessage;
+#endif
TEXTMETRIC TM;
HWND ParentWindow = NULL;
|