aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorCameron Cawley2019-03-31 19:07:40 +0100
committerFilippos Karapetis2019-04-15 08:06:39 +0300
commitbcef809e612177c2bcb7ca3f8682ea96d38c4cdc (patch)
tree14bc067ff02ef2e1aabd19360db67e22deb8704f /backends/platform
parent82f4ee86a9824a9cdfd5060d7bab23be381a46df (diff)
downloadscummvm-rg350-bcef809e612177c2bcb7ca3f8682ea96d38c4cdc.tar.gz
scummvm-rg350-bcef809e612177c2bcb7ca3f8682ea96d38c4cdc.tar.bz2
scummvm-rg350-bcef809e612177c2bcb7ca3f8682ea96d38c4cdc.zip
WINCE: Fix compilation
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/wince/CEDevice.h2
-rw-r--r--backends/platform/wince/CELauncherDialog.cpp2
-rw-r--r--backends/platform/wince/CEgui/GUIElement.h2
-rw-r--r--backends/platform/wince/missing/assert.h8
-rw-r--r--backends/platform/wince/missing/errno.h3
-rw-r--r--backends/platform/wince/missing/fopen.h (renamed from backends/platform/wince/missing/io.h)4
-rw-r--r--backends/platform/wince/missing/missing.cpp28
-rw-r--r--backends/platform/wince/missing/time.h4
-rw-r--r--backends/platform/wince/portdefs.h9
-rw-r--r--backends/platform/wince/wince-sdl.cpp12
-rw-r--r--backends/platform/wince/wince.mk2
11 files changed, 33 insertions, 43 deletions
diff --git a/backends/platform/wince/CEDevice.h b/backends/platform/wince/CEDevice.h
index 2032b7fb27..c43e4e6999 100644
--- a/backends/platform/wince/CEDevice.h
+++ b/backends/platform/wince/CEDevice.h
@@ -23,6 +23,8 @@
#ifndef CEDEVICE_H
#define CEDEVICE_H
+#include <windows.h>
+
#include "common/scummsys.h"
#include "common/system.h"
#include "common/str.h"
diff --git a/backends/platform/wince/CELauncherDialog.cpp b/backends/platform/wince/CELauncherDialog.cpp
index f7795dfdef..71650060a7 100644
--- a/backends/platform/wince/CELauncherDialog.cpp
+++ b/backends/platform/wince/CELauncherDialog.cpp
@@ -95,7 +95,7 @@ void CELauncherDialog::addGame() {
updateListing();
selectTarget(newTarget);
}
- draw();
+ g_gui.scheduleTopDialogRedraw();
} else
GUILauncherDialog::addGame();
}
diff --git a/backends/platform/wince/CEgui/GUIElement.h b/backends/platform/wince/CEgui/GUIElement.h
index 6695029877..57c6e321e7 100644
--- a/backends/platform/wince/CEgui/GUIElement.h
+++ b/backends/platform/wince/CEgui/GUIElement.h
@@ -23,6 +23,8 @@
#ifndef CEGUI_GUIELEMENT_H
#define CEGUI_GUIELEMENT_H
+#include <windows.h>
+
#include "common/scummsys.h"
#include "common/system.h"
diff --git a/backends/platform/wince/missing/assert.h b/backends/platform/wince/missing/assert.h
deleted file mode 100644
index e9c871da60..0000000000
--- a/backends/platform/wince/missing/assert.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Header is not present in Windows CE SDK */
-
-// defined in common/util.h
-void CDECL _declspec(noreturn) error(const char *s, ...);
-
-#define assert(e) ((e) ? 0 : (::error("Assertion failed %s (%s, %d)", #e, __FILE__, __LINE__)))
-
-#define abort() ::error("Abort (%s, %d)", __FILE__, __LINE__)
diff --git a/backends/platform/wince/missing/errno.h b/backends/platform/wince/missing/errno.h
index 7ee9f5e5ba..1d13c5d7d8 100644
--- a/backends/platform/wince/missing/errno.h
+++ b/backends/platform/wince/missing/errno.h
@@ -1 +1,4 @@
/* Header is not present in Windows CE SDK */
+
+extern int errno;
+#define EINTR 4
diff --git a/backends/platform/wince/missing/io.h b/backends/platform/wince/missing/fopen.h
index b2cb2abd8e..b4f7d03129 100644
--- a/backends/platform/wince/missing/io.h
+++ b/backends/platform/wince/missing/fopen.h
@@ -1,11 +1,11 @@
/* Header is not present in Windows CE SDK */
+extern "C" {
/* This stuff will live here until port configuration file is in place */
-#define strdup _strdup
-
#ifndef _FILE_DEFINED
typedef void FILE;
#define _FILE_DEFINED
#endif
FILE *wce_fopen(const char *fname, const char *fmode);
#define fopen wce_fopen
+}
diff --git a/backends/platform/wince/missing/missing.cpp b/backends/platform/wince/missing/missing.cpp
index 0355f35a69..ab193a198b 100644
--- a/backends/platform/wince/missing/missing.cpp
+++ b/backends/platform/wince/missing/missing.cpp
@@ -36,8 +36,6 @@
#include <stdio.h>
#include "common/debug.h"
-char *strdup(const char *strSource);
-
#ifdef __GNUC__
#define EXT_C extern "C"
#else
@@ -46,6 +44,10 @@ char *strdup(const char *strSource);
// common missing functions required by both gcc and evc
+#ifndef USE_ZLIB
+int errno = 0;
+#endif
+
void *bsearch(const void *key, const void *base, size_t nmemb,
size_t size, int (*compar)(const void *, const void *)) {
// Perform binary search
@@ -68,7 +70,7 @@ void *bsearch(const void *key, const void *base, size_t nmemb,
static char cwd[MAX_PATH + 1] = "";
-EXT_C char *getcwd(char *buffer, int maxlen) {
+EXT_C char *wce_getcwd(char *buffer, int maxlen) {
TCHAR fileUnc[MAX_PATH + 1];
char *plast;
@@ -91,7 +93,7 @@ EXT_C char *getcwd(char *buffer, int maxlen) {
#undef GetCurrentDirectory
#endif
EXT_C void GetCurrentDirectory(int len, char *buf) {
- getcwd(buf, len);
+ wce_getcwd(buf, len);
}
/*
@@ -106,7 +108,7 @@ EXT_C FILE *wce_fopen(const char *fname, const char *fmode) {
if (!fname || fname[0] == '\0')
return NULL;
if (fname[0] != '\\' && fname[0] != '/') {
- getcwd(fullname, MAX_PATH);
+ wce_getcwd(fullname, MAX_PATH);
strcat(fullname, "\\");
strcat(fullname, fname);
return fopen(fullname, fmode);
@@ -128,7 +130,7 @@ int _access(const char *path, int mode) {
char fullname[MAX_PATH + 1];
if (path[0] != '\\' && path[0] != '/') {
- getcwd(fullname, MAX_PATH);
+ wce_getcwd(fullname, MAX_PATH);
strcat(fullname, "\\");
strcat(fullname, path);
MultiByteToWideChar(CP_ACP, 0, fullname, -1, fname, sizeof(fname) / sizeof(TCHAR));
@@ -179,20 +181,8 @@ int _access(const char *path, int mode) {
return -1;
}
-// evc only functions follow
-#ifndef __GNUC__
-
-char *strdup(const char *strSource) {
- char *buffer;
- size_z len = strlen(strSource) + 1;
- buffer = (char *)malloc(len);
- if (buffer)
- memcpy(buffer, strSource, len);
- return buffer;
-}
-
// gcc build only functions follow
-#else // defined(__GNUC__)
+#if defined(__GNUC__)
#ifndef __MINGW32CE__
int islower(int c) {
diff --git a/backends/platform/wince/missing/time.h b/backends/platform/wince/missing/time.h
index a0ba6c246e..156d2f6a36 100644
--- a/backends/platform/wince/missing/time.h
+++ b/backends/platform/wince/missing/time.h
@@ -5,7 +5,9 @@
#include <stdlib.h>
-#ifndef __MINGW32CE__
+#ifdef __MINGW32CE__
+#include_next <time.h>
+#else
struct tm {
short tm_year;
short tm_mon;
diff --git a/backends/platform/wince/portdefs.h b/backends/platform/wince/portdefs.h
index c74fc39169..2283f94a2b 100644
--- a/backends/platform/wince/portdefs.h
+++ b/backends/platform/wince/portdefs.h
@@ -39,11 +39,9 @@
int isprint(int c);
int isspace(int c);
char *strrchr(const char *s, int c);
- char *strdup(const char *s);
void assert(void *expression);
void assert(int expression);
long int strtol(const char *nptr, char **endptr, int base);
- char *_strdup(const char *s);
char *strpbrk(const char *s, const char *accept);
#endif
@@ -51,7 +49,6 @@
#ifndef __GNUC__
void *bsearch(const void *, const void *, size_t, size_t, int (*x)(const void *, const void *));
- char *getcwd(char *buf, int size);
typedef int ptrdiff_t;
void GetCurrentDirectory(int len, char *buf);
#define INVALID_FILE_ATTRIBUTES 0xffffffff
@@ -60,18 +57,15 @@
#undef GetCurrentDirectory
extern "C" void GetCurrentDirectory(int len, char *buf);
#define snprintf _snprintf
- #define strdup _strdup
#define fopen wce_fopen
#endif
-#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
#include <stdarg.h>
#include <assert.h>
-#include <mmsystem.h>
#include <ctype.h>
//#include <direct.h>
#include <new>
@@ -81,6 +75,9 @@
#endif
int remove(const char *path);
int _access(const char *path, int mode);
+extern "C" {
+ char *wce_getcwd(char *buf, int size);
+}
void drawError(char *);
diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp
index 8a19eac064..cb26071c97 100644
--- a/backends/platform/wince/wince-sdl.cpp
+++ b/backends/platform/wince/wince-sdl.cpp
@@ -24,6 +24,9 @@
// Disable symbol overrides so that we can use system headers.
#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include <windows.h>
+
+#include "backends/platform/wince/missing/fopen.h"
#include "backends/platform/wince/wince-sdl.h"
#include "common/config-manager.h"
@@ -163,7 +166,6 @@ int handleException(EXCEPTION_POINTERS *exceptionPointers) {
}
#endif
-extern "C" char *getcwd(char *buf, int size);
int SDL_main(int argc, char **argv) {
FILE *newfp = NULL;
#ifdef __GNUC__
@@ -182,8 +184,8 @@ int SDL_main(int argc, char **argv) {
CEDevice::init();
/* Redirect standard input and standard output */
- strcpy(stdout_fname, getcwd(NULL, MAX_PATH));
- strcpy(stderr_fname, getcwd(NULL, MAX_PATH));
+ strcpy(stdout_fname, wce_getcwd(NULL, MAX_PATH));
+ strcpy(stderr_fname, wce_getcwd(NULL, MAX_PATH));
strcat(stdout_fname, STDOUT_FNAME);
strcat(stderr_fname, STDERR_FNAME);
#ifndef __GNUC__
@@ -279,7 +281,7 @@ int console_main(int argc, char *argv[]) {
appname = bufp;
if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0) {
- error("WinMain() error: %d", SDL_GetError());
+ error("WinMain() error: %s", SDL_GetError());
return(FALSE);
}
@@ -461,7 +463,7 @@ bool OSystem_WINCE3::isOzone() {
Common::String OSystem_WINCE3::getDefaultConfigFileName() {
char configFile[MAXPATHLEN];
- strcpy(configFile, getcwd(NULL, MAX_PATH));
+ strcpy(configFile, wce_getcwd(NULL, MAX_PATH));
strcat(configFile, "\\");
strcat(configFile, DEFAULT_CONFIG_FILE);
return configFile;
diff --git a/backends/platform/wince/wince.mk b/backends/platform/wince/wince.mk
index 64768dcc8a..2496eac5de 100644
--- a/backends/platform/wince/wince.mk
+++ b/backends/platform/wince/wince.mk
@@ -4,7 +4,7 @@ endif
ifdef DYNAMIC_MODULES
plugins: backends/platform/wince/stub.o backends/platform/wince/PocketSCUMM.o
- $(CXX) backends/platform/wince/stub.o backends/platform/wince/PocketSCUMM.o -L. -lscummvm -o scummvm.exe
+ $(CXX) -nostdlib backends/platform/wince/stub.o backends/platform/wince/PocketSCUMM.o -L. -lscummvm -o scummvm.exe
backends/platform/wince/stub.o: $(srcdir)/backends/platform/wince/stub.cpp
$(CXX) -c $(srcdir)/backends/platform/wince/stub.cpp -o backends/platform/wince/stub.o