diff --git a/engine/code/sys_win.c b/engine/code/sys_win.c
index 96b621b..1d2dce5 100644
--- a/engine/code/sys_win.c
+++ b/engine/code/sys_win.c
@@ -453,7 +453,7 @@ void Sys_Init (void)
}
-void Sys_Error (char *error, ...)
+void Sys_Error_Obsolete (char *error, ...)
{
va_list argptr;
char text[1024], text2[1024];
@@ -533,7 +533,7 @@ void Sys_Error (char *error, ...)
exit (1);
}
-void Sys_Printf (char *fmt, ...)
+void Sys_Printf_Obsolete (char *fmt, ...)
{
va_list argptr;
char text[1024];
@@ -549,7 +549,7 @@ void Sys_Printf (char *fmt, ...)
}
}
-void Sys_Quit (void)
+void Sys_Quit_Obsolete (void)
{
VID_ForceUnlockedAndReturnState ();
@@ -574,7 +574,7 @@ void Sys_Quit (void)
Sys_FloatTime
================
*/
-double Sys_FloatTime (void)
+double Sys_FloatTime_Win (void) // TODO: obsolete
{
static int sametimecount;
static unsigned int oldtime;
diff --git a/engine/projects/uniquake/uniquake.c b/engine/projects/uniquake/uniquake.c
new file mode 100644
index 0000000..a918cab
--- /dev/null
+++ b/engine/projects/uniquake/uniquake.c
@@ -0,0 +1,78 @@
+// uniquake.cpp : Defines the exported functions for the DLL.
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "uniquake.h"
+
+#include "../../code/quakedef.h"
+
+typedef struct unity_callbacks_s
+{
+ void(__stdcall *DebugLog)(const char *msg);
+ void(__stdcall *DebugLogError)(const char *msg);
+ void(__stdcall *ApplicationQuit)(int exitCode);
+ double(__stdcall *RealtimeSinceStartup)();
+} unity_callbacks_t;
+
+const unity_callbacks_t *unity_callbacks;
+
+void Sys_Error(char *error, ...)
+{
+ va_list argptr;
+ char text[1024];
+
+ va_start(argptr, error);
+ vsprintf(text, error, argptr);
+ va_end(argptr);
+
+ unity_callbacks->DebugLogError(text);
+ unity_callbacks->ApplicationQuit(1);
+}
+
+void Sys_Printf(char *fmt, ...)
+{
+ va_list argptr;
+ char text[1024];
+
+ va_start(argptr, fmt);
+ vsprintf(text, fmt, argptr);
+ va_end(argptr);
+
+ unity_callbacks->DebugLog(text);
+}
+
+void Sys_Quit(void)
+{
+ Host_Shutdown();
+ unity_callbacks->ApplicationQuit(0);
+}
+
+double Sys_FloatTime(void)
+{
+ return unity_callbacks->RealtimeSinceStartup();
+}
+
+UNIQUAKE_API void Uniquake_Echo(void(__stdcall *DebugLog)(const char *msg), const char *message)
+{
+ DebugLog(message);
+}
+
+UNIQUAKE_API void Uniquake_Init(const unity_callbacks_t *callbacks, quakeparms_t *parms)
+{
+ unity_callbacks = callbacks;
+
+ COM_InitArgv(parms->argc, parms->argv);
+ // TODO winquake writes com_argc/argv back to parms.argc/argv, is this necessary?
+
+ isDedicated = true;
+
+ Host_Init(parms);
+}
+
+UNIQUAKE_API void Uniquake_Update(float deltaTime)
+{
+ // TODO: limit ticrate when running dedicated server
+
+ Host_Frame(deltaTime);
+}
diff --git a/engine/projects/uniquake/uniquake.cpp b/engine/projects/uniquake/uniquake.cpp
deleted file mode 100644
index 48efc28..0000000
--- a/engine/projects/uniquake/uniquake.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// uniquake.cpp : Defines the exported functions for the DLL.
-//
-
-#include "pch.h"
-#include "framework.h"
-#include "uniquake.h"
-
-
-// This is an example of an exported variable
-UNIQUAKE_API int nuniquake=0;
-
-// This is an example of an exported function.
-UNIQUAKE_API int fnuniquake(void)
-{
- return 0;
-}
-
-// This is the constructor of a class that has been exported.
-Cuniquake::Cuniquake()
-{
- return;
-}
diff --git a/engine/projects/uniquake/uniquake.h b/engine/projects/uniquake/uniquake.h
index c715bd6..eef8b31 100644
--- a/engine/projects/uniquake/uniquake.h
+++ b/engine/projects/uniquake/uniquake.h
@@ -1,22 +1,6 @@
-// The following ifdef block is the standard way of creating macros which make exporting
-// from a DLL simpler. All files within this DLL are compiled with the UNIQUAKE_EXPORTS
-// symbol defined on the command line. This symbol should not be defined on any project
-// that uses this DLL. This way any other project whose source files include this file see
-// UNIQUAKE_API functions as being imported from a DLL, whereas this DLL sees symbols
-// defined with this macro as being exported.
#ifdef UNIQUAKE_EXPORTS
#define UNIQUAKE_API __declspec(dllexport)
#else
#define UNIQUAKE_API __declspec(dllimport)
#endif
-// This class is exported from the dll
-class UNIQUAKE_API Cuniquake {
-public:
- Cuniquake(void);
- // TODO: add your methods here.
-};
-
-extern UNIQUAKE_API int nuniquake;
-
-UNIQUAKE_API int fnuniquake(void);
diff --git a/engine/projects/uniquake/uniquake.vcxproj b/engine/projects/uniquake/uniquake.vcxproj
index 854def9..1029a54 100644
--- a/engine/projects/uniquake/uniquake.vcxproj
+++ b/engine/projects/uniquake/uniquake.vcxproj
@@ -71,7 +71,7 @@
- UNIQUAKE
+ uniquake
true
@@ -97,6 +97,7 @@
pch.h
+ MultiThreadedDebugDLL
Windows
@@ -354,7 +355,7 @@
Create
Create
-
+
diff --git a/engine/projects/uniquake/uniquake.vcxproj.filters b/engine/projects/uniquake/uniquake.vcxproj.filters
index 38a9eaf..d75c403 100644
--- a/engine/projects/uniquake/uniquake.vcxproj.filters
+++ b/engine/projects/uniquake/uniquake.vcxproj.filters
@@ -245,9 +245,6 @@
-
- Source Files
-
Source Files
@@ -539,6 +536,9 @@
jpeg
+
+ Source Files
+