From 3fbca9faf82b6ed49a198320e6558d357912fb53 Mon Sep 17 00:00:00 2001 From: shlainn Date: Mon, 5 May 2008 15:29:07 +0000 Subject: [PATCH] * Basic Makefile support for Linux ** To build run : autoreconf --install, ./configure, make * Minor typecasts and fixed typo to make GCC happy --- src/AUTHORS | 0 src/ChangeLog | 0 src/Client/DefScript/Makefile.am | 17 ++++++ src/Client/GUI/Makefile.am | 15 +++++ src/Client/Makefile.am | 22 +++++++ src/Client/Realm/Makefile.am | 8 +++ src/Client/SCPDatabase.cpp | 2 +- src/Client/SCPDatabase.h | 2 +- src/Client/World/Makefile.am | 18 ++++++ src/Client/World/ObjMgr.h | 4 +- src/Makefile.am | 4 ++ src/NEWS | 0 src/README | 0 src/configure.ac | 75 +++++++++++++++++++++++ src/shared/Auth/Makefile.am | 5 ++ src/shared/Makefile.am | 10 +++ src/shared/Network/Makefile.am | 5 ++ src/shared/ZCompressor.cpp | 102 ++++++++++++++++--------------- 18 files changed, 236 insertions(+), 53 deletions(-) create mode 100644 src/AUTHORS create mode 100644 src/ChangeLog create mode 100644 src/Client/DefScript/Makefile.am create mode 100644 src/Client/GUI/Makefile.am create mode 100644 src/Client/Makefile.am create mode 100644 src/Client/Realm/Makefile.am create mode 100644 src/Client/World/Makefile.am create mode 100644 src/Makefile.am create mode 100644 src/NEWS create mode 100644 src/README create mode 100644 src/configure.ac create mode 100644 src/shared/Auth/Makefile.am create mode 100644 src/shared/Makefile.am create mode 100644 src/shared/Network/Makefile.am diff --git a/src/AUTHORS b/src/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/src/ChangeLog b/src/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/src/Client/DefScript/Makefile.am b/src/Client/DefScript/Makefile.am new file mode 100644 index 0000000..2ca4a69 --- /dev/null +++ b/src/Client/DefScript/Makefile.am @@ -0,0 +1,17 @@ +## Process this file with automake to produce Makefile.in +AM_CPPFLAGS = -I$(top_builddir)/Client -I$(top_builddir)/shared -I$(top_builddir)/Client/DefScript -I$(top_builddir)/Client/World -I$(top_builddir)/Client/Realm -Wall +## Build pseuwow +noinst_LIBRARIES = libdefscript.a +libdefscript_a_SOURCES =DefScriptBBFunctions.cpp\ + DefScriptFileFunctions.cpp\ + DefScriptListFunctions.cpp\ + DynamicEvent.cpp\ + DefScript.cpp\ + DefScriptFunctions.cpp\ + DefScriptTools.cpp\ + VarSet.cpp + +libdefscript_a_LIBADD = $(top_builddir)/shared/libshared.a $(top_builddir)/shared/Auth/libauth.a $(top_builddir)/shared/Network/libnetwork.a + + + diff --git a/src/Client/GUI/Makefile.am b/src/Client/GUI/Makefile.am new file mode 100644 index 0000000..5a15828 --- /dev/null +++ b/src/Client/GUI/Makefile.am @@ -0,0 +1,15 @@ +## Process this file with automake to produce Makefile.in +AM_CPPFLAGS = -I$(top_builddir)/Client -I$(top_builddir)/shared -I$(top_builddir)/Client/DefScript -I$(top_builddir)/Client/World -I$(top_builddir)/Client/Realm -Wall +## Build pseuwow +noinst_LIBRARIES = libgui.a +libgui_a_SOURCES =CCursorController.cpp DrawObject.cpp MInput.h Scene.h SImage.h\ +CCursorController.h DrawObject.h PseuGUI.cpp SceneLogin.cpp TlTMesh.h\ +CImageLoaderBLP.cpp DrawObjMgr.cpp PseuGUI.h SceneWorld.cpp TlTSector.h\ +CImageLoaderBLP.h DrawObjMgr.h Scene.cpp ShTlTerrainSceneNode.cpp\ +CM2MeshFileLoader.cpp SceneData.h ShTlTerrainSceneNode.h\ +CM2MeshFileLoader.h MCamera.h SceneGuiStart.cpp SImage.cpp + +libgui_a_LIBADD = $(top_builddir)/shared/libshared.a $(top_builddir)/shared/Auth/libauth.a $(top_builddir)/shared/Network/libnetwork.a + + + diff --git a/src/Client/Makefile.am b/src/Client/Makefile.am new file mode 100644 index 0000000..3d15cf7 --- /dev/null +++ b/src/Client/Makefile.am @@ -0,0 +1,22 @@ +## Process this file with automake to produce Makefile.in +SUBDIRS = DefScript Realm World GUI +AM_CPPFLAGS = -I$(top_builddir)/Client -I$(top_builddir)/shared -I$(top_builddir)/Client/DefScript -I$(top_builddir)/Client/World -I$(top_builddir)/Client/Realm -Wall +## Build pseuwow +bin_PROGRAMS = pseuwow +pseuwow_SOURCES = Cli.cpp\ + DefScriptInterface.cpp\ + MemoryDataHolder.cpp\ + RemoteController.cpp\ + ControlSocket.cpp\ + main.cpp\ + PseuWoW.cpp\ + SCPDatabase.cpp\ + Realm/RealmSession.cpp\ + Realm/RealmSocket.cpp\ + World/WorldSocket.cpp\ + World/UpdateData.cpp\ + World/MapMgr.cpp + + +pseuwow_LDADD = ../shared/libshared.a ../shared/Auth/libauth.a ../shared/Network/libnetwork.a DefScript/libdefscript.a World/libworld.a GUI/libgui.a +pseuwow_LDFLAGS =-pthread \ No newline at end of file diff --git a/src/Client/Realm/Makefile.am b/src/Client/Realm/Makefile.am new file mode 100644 index 0000000..ad2495f --- /dev/null +++ b/src/Client/Realm/Makefile.am @@ -0,0 +1,8 @@ +## Process this file with automake to produce Makefile.in +AM_CPPFLAGS = -I$(top_builddir)/Client -I$(top_builddir)/shared -I$(top_builddir)/Client/DefScript -I$(top_builddir)/Client/World -I$(top_builddir)/Client/Realm -Wall +## Build pseuwow +noinst_LIBRARIES = librealm.a +librealm_a_SOURCES =RealmSession.cpp RealmSession.h RealmSocket.cpp RealmSocket.h +librealm_a_LIBADD = $(top_builddir)/shared/libshared.a $(top_builddir)/shared/Auth/libauth.a $(top_builddir)/shared/Network/libnetwork.a + + diff --git a/src/Client/SCPDatabase.cpp b/src/Client/SCPDatabase.cpp index 6150868..d46723d 100644 --- a/src/Client/SCPDatabase.cpp +++ b/src/Client/SCPDatabase.cpp @@ -7,7 +7,7 @@ inline char *gettypename(uint32 ty) { - return (ty==0 ? "INT" : (ty==1 ? "FLOAT" : "STRING")); + return (char*)(ty==0 ? "INT" : (ty==1 ? "FLOAT" : "STRING")); } // file-globally declared pointer holder. NOT multi-instance-safe for now!! diff --git a/src/Client/SCPDatabase.h b/src/Client/SCPDatabase.h index 84c9906..4f4e167 100644 --- a/src/Client/SCPDatabase.h +++ b/src/Client/SCPDatabase.h @@ -41,7 +41,7 @@ public: // access funcs void *GetPtr(uint32 index, char *entry); void *GetPtrByField(uint32 index, uint32 entry); - inline char *GetStringByOffset(uint32 offs) { return (offs < _stringsize ? _stringbuf + offs : ""); } + inline char *GetStringByOffset(uint32 offs) { return (char*)(offs < _stringsize ? _stringbuf + offs : ""); } inline char *GetString(uint32 index, char *entry) { return GetStringByOffset(GetUint32(index,entry)); } inline char *GetString(uint32 index, uint32 entry) { return GetStringByOffset(GetUint32(index,entry)); } inline uint32 GetUint32(uint32 index, char *entry) { uint32 *t = (uint32*)GetPtr(index,entry); return t ? *t : 0; } diff --git a/src/Client/World/Makefile.am b/src/Client/World/Makefile.am new file mode 100644 index 0000000..7afaa76 --- /dev/null +++ b/src/Client/World/Makefile.am @@ -0,0 +1,18 @@ +## Process this file with automake to produce Makefile.in +AM_CPPFLAGS = -I$(top_builddir)/Client -I$(top_builddir)/shared -I$(top_builddir)/Client/DefScript -I$(top_builddir)/Client/World -I$(top_builddir)/Client/Realm -Wall +## Build pseuwow +noinst_LIBRARIES = libworld.a +libworld_a_SOURCES =Bag.cpp DynamicObject.cpp MovementMgr.cpp Player.cpp World.cpp\ +Bag.h DynamicObject.h MovementMgr.h Player.h World.h\ +CacheHandler.cpp GameObject.cpp Object.cpp SharedDefines.h WorldPacket.cpp\ +CacheHandler.h GameObject.h ObjectDefines.h Unit.cpp WorldPacket.h\ +Channel.cpp Item.cpp Object.h Unit.h WorldSession.cpp\ +Channel.h Item.h ObjMgr.cpp UpdateData.cpp WorldSession.h\ +CMSGConstructor.cpp ObjMgr.h UpdateData.h WorldSocket.cpp\ +Corpse.cpp MapMgr.cpp Opcodes.cpp UpdateFields.h WorldSocket.h\ +Corpse.h MapMgr.h Opcodes.h UpdateMask.h + +libworld_a_LIBADD = ../../shared/libshared.a ../../shared/Auth/libauth.a ../../shared/Network/libnetwork.a +libworld_a_LIBFLAGS = -pthread + + diff --git a/src/Client/World/ObjMgr.h b/src/Client/World/ObjMgr.h index 0b9f0df..acd70f7 100644 --- a/src/Client/World/ObjMgr.h +++ b/src/Client/World/ObjMgr.h @@ -5,7 +5,7 @@ #include #include "Item.h" #include "Unit.h" -#include "Gameobject.h" +#include "GameObject.h" typedef std::map ItemProtoMap; typedef std::map CreatureTemplateMap; @@ -81,4 +81,4 @@ private: }; -#endif +#endif diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..e64eb53 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,4 @@ +## Makefile.am - process this file with automake +AM_CPPFLAGS = -I$(top_builddir)/Client -I$(top_builddir)/shared -I$(top_builddir)/Client/DefScript -I$(top_builddir)/Client/World -I$(top_builddir)/Client/Realm -Wall +SUBDIRS = shared Client +## End Makefile.am diff --git a/src/NEWS b/src/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/src/README b/src/README new file mode 100644 index 0000000..e69de29 diff --git a/src/configure.ac b/src/configure.ac new file mode 100644 index 0000000..de7c5bc --- /dev/null +++ b/src/configure.ac @@ -0,0 +1,75 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.61) +AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) +AM_INIT_AUTOMAKE(pseuwow, 0.1) +#AC_CONFIG_SRCDIR([shared/ProgressBar.h]) +AM_CONFIG_HEADER([config.h]) + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_RANLIB + +# Checks for libraries. +AC_CHECK_LIB([Xxf86vm], [main]) +AC_CHECK_LIB([GL], [main]) +AC_CHECK_LIB([GLU], [main]) +AC_CHECK_LIB([Irrlicht], [main]) +AC_CHECK_LIB([ssl], [main]) +AC_CHECK_LIB([crypto], [main]) +AC_CHECK_LIB([ZThread], [main]) + +# Checks for header files. +AC_PATH_X +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h limits.h malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/param.h sys/socket.h sys/time.h sys/timeb.h unistd.h utime.h wchar.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_C_INLINE +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_HEADER_TIME +AC_STRUCT_TM +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_C_VOLATILE +AC_CHECK_TYPES([ptrdiff_t]) + +# Checks for library functions. +AC_FUNC_CHOWN +AC_FUNC_CLOSEDIR_VOID +AC_FUNC_ERROR_AT_LINE +AC_FUNC_MALLOC +AC_FUNC_MEMCMP +AC_FUNC_SELECT_ARGTYPES +AC_TYPE_SIGNAL +AC_FUNC_STAT +AC_FUNC_UTIME_NULL +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([floor ftime ftruncate getcwd gethostbyaddr gethostbyname gethostname gettimeofday memmove memset mkdir pow realpath select socket sqrt strerror strrchr strstr strtol strtoul uname utime]) + +#AC_CONFIG_FILES([dep/src/irrlicht/Makefile +# dep/src/zlib/Makefile +# dep/src/zthread/Makefile]) +#AC_CONFIG_SUBDIRS([dep/src/irrlicht/jpeglib +# dep/src/irrlicht/libpng]) +AC_CONFIG_FILES([Makefile + shared/Makefile + shared/Auth/Makefile + shared/Network/Makefile + Client/Makefile + Client/GUI/Makefile + Client/Realm/Makefile + Client/World/Makefile + Client/DefScript/Makefile]) +AC_OUTPUT diff --git a/src/shared/Auth/Makefile.am b/src/shared/Auth/Makefile.am new file mode 100644 index 0000000..35193d5 --- /dev/null +++ b/src/shared/Auth/Makefile.am @@ -0,0 +1,5 @@ +## Process this file with automake to produce Makefile.in +AM_CPPFLAGS = -I$(top_builddir)/Client -I$(top_builddir)/shared -I$(top_builddir)/Client/DefScript -I$(top_builddir)/Client/World -I$(top_builddir)/Client/Realm -Wall +## Build pseuwow +noinst_LIBRARIES = libauth.a +libauth_a_SOURCES = AuthCrypt.cpp BigNumber.cpp md5.c Sha1.cpp diff --git a/src/shared/Makefile.am b/src/shared/Makefile.am new file mode 100644 index 0000000..141f59f --- /dev/null +++ b/src/shared/Makefile.am @@ -0,0 +1,10 @@ +## Process this file with automake to produce Makefile.in +SUBDIRS = Auth Network +AM_CPPFLAGS = -I$(top_builddir)/Client -I$(top_builddir)/shared -I$(top_builddir)/Client/DefScript -I$(top_builddir)/Client/World -I$(top_builddir)/Client/Realm -Wall +## Build pseuwow +noinst_LIBRARIES = libshared.a +libshared_a_SOURCES = ADTFile.cpp common.h log.h MapTile.h tools.cpp Widen.h\ +ADTFile.h DebugStuff.h ProgressBar.cpp tools.h ZCompressor.cpp\ +ADTFileStructs.h libshared.a ProgressBar.h WDTFile.cpp ZCompressor.h\ +ByteBuffer.h log.cpp MapTile.cpp SysDefs.h WDTFile.h + diff --git a/src/shared/Network/Makefile.am b/src/shared/Network/Makefile.am new file mode 100644 index 0000000..ca59a8e --- /dev/null +++ b/src/shared/Network/Makefile.am @@ -0,0 +1,5 @@ +## Process this file with automake to produce Makefile.in +AM_CPPFLAGS = -I$(top_builddir)/Client -I$(top_builddir)/shared -I$(top_builddir)/Client/DefScript -I$(top_builddir)/Client/World -I$(top_builddir)/Client/Realm -Wall +## Build pseuwow +noinst_LIBRARIES = libnetwork.a +libnetwork_a_SOURCES =Base64.cpp PoolSocket.cpp Socket.cpp SocketThread.cpp Thread.cpp CircularBuffer.cpp ResolvServer.cpp SocketHandler.cpp StdoutLog.cpp UdpSocket.cpp Parse.cpp ResolvSocket.cpp socket_include.cpp TcpSocket.cpp Utility.cpp diff --git a/src/shared/ZCompressor.cpp b/src/shared/ZCompressor.cpp index bd08923..114b3dd 100644 --- a/src/shared/ZCompressor.cpp +++ b/src/shared/ZCompressor.cpp @@ -1,5 +1,9 @@ #include "common.h" +#if PLATFORM == PLATFORM_UNIX +#include "zlib.h" +#else #include "zlib/zlib.h" +#endif #include "ZCompressor.h" ZCompressor::ZCompressor() @@ -10,55 +14,55 @@ ZCompressor::ZCompressor() void ZCompressor::_compress(void* dst, uint32 *dst_size, void* src, uint32 src_size, uint8 level) { - z_stream c_stream; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - // default Z_BEST_SPEED (1) - if (Z_OK != deflateInit(&c_stream, level)) - { - //printf("ZLIB: Can't compress (zlib: deflateInit).\n"); - *dst_size = 0; - return; - } - - c_stream.next_out = (Bytef*)dst; - c_stream.avail_out = *dst_size; - c_stream.next_in = (Bytef*)src; - c_stream.avail_in = (uInt)src_size; - - if (Z_OK != deflate(&c_stream, Z_NO_FLUSH)) - { - //printf("ZLIB: Can't compress (zlib: deflate)\n"); - *dst_size = 0; - return; - } - - if (c_stream.avail_in != 0) - { - //printf("Can't compress (zlib: deflate not greedy)\n"); - *dst_size = 0; - return; - } - - if (Z_STREAM_END != deflate(&c_stream, Z_FINISH)) - { - //printf("Can't compress (zlib: deflate should report Z_STREAM_END)\n"); - *dst_size = 0; - //return; - exit(1); - } - - if (Z_OK != deflateEnd(&c_stream)) - { - //printf("Can't compress (zlib: deflateEnd)\n"); - *dst_size = 0; - return; - } - - *dst_size = c_stream.total_out; + z_stream c_stream; + + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; + + // default Z_BEST_SPEED (1) + if (Z_OK != deflateInit(&c_stream, level)) + { + //printf("ZLIB: Can't compress (zlib: deflateInit).\n"); + *dst_size = 0; + return; + } + + c_stream.next_out = (Bytef*)dst; + c_stream.avail_out = *dst_size; + c_stream.next_in = (Bytef*)src; + c_stream.avail_in = (uInt)src_size; + + if (Z_OK != deflate(&c_stream, Z_NO_FLUSH)) + { + //printf("ZLIB: Can't compress (zlib: deflate)\n"); + *dst_size = 0; + return; + } + + if (c_stream.avail_in != 0) + { + //printf("Can't compress (zlib: deflate not greedy)\n"); + *dst_size = 0; + return; + } + + if (Z_STREAM_END != deflate(&c_stream, Z_FINISH)) + { + //printf("Can't compress (zlib: deflate should report Z_STREAM_END)\n"); + *dst_size = 0; + //return; + exit(1); + } + + if (Z_OK != deflateEnd(&c_stream)) + { + //printf("Can't compress (zlib: deflateEnd)\n"); + *dst_size = 0; + return; + } + + *dst_size = c_stream.total_out; }