From 11493e3daca7acbe035378cff1d5334482ca2a84 Mon Sep 17 00:00:00 2001 From: nomdenom Date: Sun, 23 Sep 2018 12:31:09 -0700 Subject: [PATCH] Source: MINIWIN headers support --- 3rdParty/Storm/Source/storm.h | 4 ++++ Source/codec.cpp | 5 +++++ Source/engine.cpp | 2 ++ Source/nthread.cpp | 2 ++ types.h | 7 ++++++- 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/3rdParty/Storm/Source/storm.h b/3rdParty/Storm/Source/storm.h index 3e3b173a9..369bf349d 100644 --- a/3rdParty/Storm/Source/storm.h +++ b/3rdParty/Storm/Source/storm.h @@ -3,10 +3,14 @@ #ifndef __BLIZZARD_STORM_HEADER #define __BLIZZARD_STORM_HEADER +#ifndef MINIWIN #include #include #include #include +#else +#include "miniwin.h" +#endif // Note to self: Linker error => forgot a return value in cpp diff --git a/Source/codec.cpp b/Source/codec.cpp index 805fd365f..0b6fd982f 100644 --- a/Source/codec.cpp +++ b/Source/codec.cpp @@ -2,6 +2,11 @@ #include "../types.h" +#ifdef MINIWIN +#define srand srand_miniwin +#define rand rand_miniwin +#endif + int __fastcall codec_decode(void *pbSrcDst, int size, char *pszPassword) { unsigned int v3; // ebx diff --git a/Source/engine.cpp b/Source/engine.cpp index 217c954a2..63259e091 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -1859,6 +1859,7 @@ int __fastcall random(BYTE idx, int v) return (GetRndSeed() >> 16) % v; } +#ifndef MINIWIN struct engine_cpp_init_2 { engine_cpp_init_2() @@ -1867,6 +1868,7 @@ struct engine_cpp_init_2 mem_atexit_mutex(); } } _engine_cpp_init_2; +#endif void __cdecl mem_init_mutex() { diff --git a/Source/nthread.cpp b/Source/nthread.cpp index 060715e28..543e02c37 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -35,6 +35,7 @@ struct nthread_cpp_init_1 // 47F164: using guessed type int nthread_inf; // 679700: using guessed type int nthread_cpp_init_value; +#ifndef MINIWIN struct nthread_cpp_init_2 { nthread_cpp_init_2() @@ -43,6 +44,7 @@ struct nthread_cpp_init_2 nthread_cleanup_mutex_atexit(); } } _nthread_cpp_init_2; +#endif void __cdecl nthread_init_mutex() { diff --git a/types.h b/types.h index ebf72d336..48a8f4c84 100644 --- a/types.h +++ b/types.h @@ -3,10 +3,14 @@ #ifndef _TYPES_H #define _TYPES_H -#define WIN32_LEAN_AND_MEAN #include "resource.h" +#ifdef MINIWIN +#include "miniwin.h" +#else +#define WIN32_LEAN_AND_MEAN + #include #include #include @@ -18,6 +22,7 @@ #include #include #include +#endif #ifdef __GNUC__ #include