Merge with default

--HG--
branch : sse2
hg/feature/sse2
kaetemi 11 years ago
commit b074ec61b5

@ -118,13 +118,13 @@ MACRO(NL_DEFAULT_PROPS name label)
ENDIF(NL_LIB_PREFIX) ENDIF(NL_LIB_PREFIX)
ENDIF(${type} STREQUAL SHARED_LIBRARY) ENDIF(${type} STREQUAL SHARED_LIBRARY)
IF(${type} STREQUAL EXECUTABLE AND WIN32) IF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW)
SET_TARGET_PROPERTIES(${name} PROPERTIES SET_TARGET_PROPERTIES(${name} PROPERTIES
VERSION ${NL_VERSION} VERSION ${NL_VERSION}
SOVERSION ${NL_VERSION_MAJOR} SOVERSION ${NL_VERSION_MAJOR}
COMPILE_FLAGS "/GA" COMPILE_FLAGS "/GA"
LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}") LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}")
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32) ENDIF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW)
ENDMACRO(NL_DEFAULT_PROPS) ENDMACRO(NL_DEFAULT_PROPS)
### ###
@ -878,9 +878,9 @@ MACRO(NL_SETUP_BUILD)
ENDIF(APPLE) ENDIF(APPLE)
# Fix "relocation R_X86_64_32 against.." error on x64 platforms # Fix "relocation R_X86_64_32 against.." error on x64 platforms
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS) IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW)
ADD_PLATFORM_FLAGS("-fPIC") ADD_PLATFORM_FLAGS("-fPIC")
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS) ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW)
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48") SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")

@ -182,7 +182,7 @@ public:
IDriver(); IDriver();
virtual ~IDriver(); virtual ~IDriver();
virtual bool init(uint windowIcon = 0, emptyProc exitFunc = 0) = 0; virtual bool init(uintptr_t windowIcon = 0, emptyProc exitFunc = 0) = 0;
/// Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers). /// Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers).
virtual bool release(); virtual bool release();
@ -1341,7 +1341,7 @@ public:
* NB: if implementation does not support it, 0 may be returned. OpenGL ones return the Texture ID. * NB: if implementation does not support it, 0 may be returned. OpenGL ones return the Texture ID.
* NB: unlike isTextureExist(), this method is not thread safe. * NB: unlike isTextureExist(), this method is not thread safe.
*/ */
virtual uint getTextureHandle(const ITexture&tex) = 0; virtual uintptr_t getTextureHandle(const ITexture&tex) = 0;
// see if the Multiply-Add Tex Env operator is supported (see CMaterial::Mad) // see if the Multiply-Add Tex Env operator is supported (see CMaterial::Mad)
virtual bool supportMADOperator() const = 0; virtual bool supportMADOperator() const = 0;

@ -123,7 +123,7 @@ public:
/// \name Object /// \name Object
// @{ // @{
CDriverUser (uint windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0); CDriverUser (uintptr_t windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0);
virtual ~CDriverUser(); virtual ~CDriverUser();
// @} // @}

@ -24,8 +24,11 @@
#include "nel/misc/geom_ext.h" #include "nel/misc/geom_ext.h"
#include "nel/misc/line.h" #include "nel/misc/line.h"
#if defined (NL_COMP_MINGW)
#ifdef NL_OS_WINDOWS # define NL3D_GL_DLL_NAME "libnel_drv_opengl_win"
# define NL3D_GLES_DLL_NAME "libnel_drv_opengles_win"
# define NL3D_D3D_DLL_NAME "libnel_drv_direct3d_win"
#elif defined (NL_OS_WINDOWS)
# define NL3D_GL_DLL_NAME "nel_drv_opengl_win" # define NL3D_GL_DLL_NAME "nel_drv_opengl_win"
# define NL3D_GLES_DLL_NAME "nel_drv_opengles_win" # define NL3D_GLES_DLL_NAME "nel_drv_opengles_win"
# define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win" # define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win"

@ -54,7 +54,7 @@ public:
// The index of the skin rdrPass // The index of the skin rdrPass
uint16 RdrPassIndex; uint16 RdrPassIndex;
// The texture id of the specular texture. This is the sort Key. // The texture id of the specular texture. This is the sort Key.
uint32 SpecId; uintptr_t SpecId;
bool operator<(const CSkinSpecularRdrPass &o) const bool operator<(const CSkinSpecularRdrPass &o) const
{ {

@ -845,8 +845,8 @@ public:
/** /**
* This is the static function which build a UDriver, the root for all 3D functions. * This is the static function which build a UDriver, the root for all 3D functions.
*/ */
static UDriver *createDriver(uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0); static UDriver *createDriver(uintptr_t windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
static UDriver *createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc = 0); static UDriver *createDriver(uintptr_t windowIcon, TDriver driver, emptyProc exitFunc = 0);
/** /**
* Purge static memory * Purge static memory

@ -34,7 +34,9 @@
#include "events.h" #include "events.h"
#include "rect.h" #include "rect.h"
#include "game_device.h" #include "game_device.h"
#define NOMINMAX #ifndef NL_COMP_MINGW
# define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#include <dinput.h> #include <dinput.h>
@ -101,7 +103,7 @@ public:
* \param we A windows eventsemitter. Can be NULL. Needed if you want to mix WIN32 events and Direct Input events * \param we A windows eventsemitter. Can be NULL. Needed if you want to mix WIN32 events and Direct Input events
* (for example, a Direct Input Mouse and a Win32 Keyboard) * (for example, a Direct Input Mouse and a Win32 Keyboard)
*/ */
static CDIEventEmitter *create(HINSTANCE hinst, HWND hwnd, CWinEventEmitter *we); static CDIEventEmitter *create(HINSTANCE hinst, HWND hwnd, CWinEventEmitter *we) throw(EDirectInput);
~CDIEventEmitter(); ~CDIEventEmitter();
public: public:

@ -220,7 +220,7 @@ private:
static TOldWinProcMap _OldWinProcMap; static TOldWinProcMap _OldWinProcMap;
bool initInternal(HINSTANCE hInstance, HWND ownerWindow, uint32 localId, uint32 foreignId = NULL); bool initInternal(HINSTANCE hInstance, HWND ownerWindow, uint32 localId, uint32 foreignId = 0);
private: private:
static LRESULT CALLBACK listenerProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK listenerProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

@ -86,6 +86,10 @@
# define NL_COMP_VC_VERSION 60 # define NL_COMP_VC_VERSION 60
# define NL_COMP_NEED_PARAM_ON_METHOD # define NL_COMP_NEED_PARAM_ON_METHOD
# endif # endif
# elif defined(__MINGW32__)
# define NL_COMP_MINGW
# define NL_COMP_GCC
# define NL_NO_ASM
# endif # endif
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later # if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later
# define NL_ISO_STDTR1_AVAILABLE # define NL_ISO_STDTR1_AVAILABLE
@ -93,9 +97,13 @@
# define NL_ISO_STDTR1_NAMESPACE std::tr1 # define NL_ISO_STDTR1_NAMESPACE std::tr1
# endif # endif
# ifdef _DEBUG # ifdef _DEBUG
# define NL_DEBUG # ifndef NL_DEBUG
# define NL_DEBUG
# endif
# elif defined (NDEBUG) # elif defined (NDEBUG)
# define NL_RELEASE # ifndef NL_RELEASE
# define NL_RELEASE
# endif
# else # else
# error "Don't know the compilation mode" # error "Don't know the compilation mode"
# endif # endif
@ -109,7 +117,9 @@
# define _WIN32_WINNT 0x0600 // force VISTA minimal version in 64 bits # define _WIN32_WINNT 0x0600 // force VISTA minimal version in 64 bits
# endif # endif
// define NOMINMAX to be sure that windows includes will not define min max macros, but instead, use the stl template // define NOMINMAX to be sure that windows includes will not define min max macros, but instead, use the stl template
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
#else #else
# ifdef __APPLE__ # ifdef __APPLE__
# define NL_OS_MAC # define NL_OS_MAC

@ -22,7 +22,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define NOMINMAX #ifndef NL_COMP_MINGW
# define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#include "displayer.h" #include "displayer.h"

@ -50,10 +50,10 @@ public:
virtual ~CBufSock(); virtual ~CBufSock();
/// Sets the application identifier /// Sets the application identifier
void setAppId( uint64 id ) { _AppId = id; } void setAppId( uintptr_t id ) { _AppId = id; }
/// Returns the application identifier /// Returns the application identifier
uint64 appId() const { return _AppId; } uintptr_t appId() const { return _AppId; }
/// Returns a string with the characteristics of the object /// Returns a string with the characteristics of the object
std::string asString() const; std::string asString() const;
@ -256,7 +256,7 @@ private:
NLMISC::CObjectVector<uint8> _ReadyToSendBuffer; NLMISC::CObjectVector<uint8> _ReadyToSendBuffer;
TBlockSize _RTSBIndex; TBlockSize _RTSBIndex;
uint64 _AppId; uintptr_t _AppId;
// Connected state (from the user's point of view, i.e. changed when the connection/disconnection event is at the front of the receive queue) // Connected state (from the user's point of view, i.e. changed when the connection/disconnection event is at the front of the receive queue)
bool _ConnectedState; bool _ConnectedState;

@ -38,7 +38,9 @@
#include "nel/3d/event_mouse_listener.h" #include "nel/3d/event_mouse_listener.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -30,7 +30,9 @@
#include "nel/3d/driver_user.h" #include "nel/3d/driver_user.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#define NOMINMAX #ifndef NL_COMP_MINGW
#define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -29,7 +29,9 @@
#include <nel/3d/u_instance.h> #include <nel/3d/u_instance.h>
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#define NOMINMAX #ifndef NL_COMP_MINGW
#define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -14,7 +14,9 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef __GNUC__ #include "nel/misc/types_nl.h"
#ifndef NL_OS_WINDOWS
#include "kbhit.h" #include "kbhit.h"
#include <termios.h> #include <termios.h>
#include <unistd.h> // for read() #include <unistd.h> // for read()

@ -24,7 +24,9 @@
#include "nel/net/callback_server.h" #include "nel/net/callback_server.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -37,7 +37,9 @@
#include "nel/net/transport_class.h" #include "nel/net/transport_class.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -37,7 +37,9 @@
#include "nel/net/transport_class.h" #include "nel/net/transport_class.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -34,7 +34,9 @@
#include "nel/net/login_server.h" #include "nel/net/login_server.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -43,7 +43,9 @@
#include "receive_task.h" #include "receive_task.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -18,7 +18,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#elif defined NL_OS_UNIX #elif defined NL_OS_UNIX

@ -10,7 +10,7 @@ NL_DEFAULT_PROPS(nel_drv_direct3d_win "NeL, Driver, Video: Direct3D")
NL_ADD_RUNTIME_FLAGS(nel_drv_direct3d_win) NL_ADD_RUNTIME_FLAGS(nel_drv_direct3d_win)
NL_ADD_LIB_SUFFIX(nel_drv_direct3d_win) NL_ADD_LIB_SUFFIX(nel_drv_direct3d_win)
ADD_DEFINITIONS(/Ddriver_direct3d_EXPORTS) ADD_DEFINITIONS(-DRIVER_DIRECT3D_EXPORTS)
IF(WITH_PCH) IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_direct3d_win ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.cpp) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_direct3d_win ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.cpp)

@ -110,6 +110,10 @@ IDriver* createD3DDriverInstance ()
#else #else
#ifdef NL_COMP_MINGW
extern "C"
{
#endif
__declspec(dllexport) IDriver* NL3D_createIDriverInstance () __declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
{ {
return new CDriverD3D; return new CDriverD3D;
@ -119,7 +123,9 @@ __declspec(dllexport) uint32 NL3D_interfaceVersion ()
{ {
return IDriver::InterfaceVersion; return IDriver::InterfaceVersion;
} }
#ifdef NL_COMP_MINGW
}
#endif
#endif #endif
/*static*/ bool CDriverD3D::_CacheTest[CacheTest_Count] = /*static*/ bool CDriverD3D::_CacheTest[CacheTest_Count] =
@ -379,7 +385,7 @@ void CDriverD3D::resetRenderVariables()
} }
for (i=0; i<MaxTexture; i++) for (i=0; i<MaxTexture; i++)
{ {
if ((uint32)(_TexturePtrStateCache[i].Texture) != 0xcccccccc) if ((uintptr_t)(_TexturePtrStateCache[i].Texture) != 0xcccccccc)
{ {
touchRenderVariable (&(_TexturePtrStateCache[i])); touchRenderVariable (&(_TexturePtrStateCache[i]));
// reset texture because it may reference an old render target // reset texture because it may reference an old render target
@ -419,7 +425,7 @@ void CDriverD3D::resetRenderVariables()
for (i=0; i<MaxLight; i++) for (i=0; i<MaxLight; i++)
{ {
if (*(uint32*)(&(_LightCache[i].Light)) != 0xcccccccc) if (*(uintptr_t*)(&(_LightCache[i].Light)) != 0xcccccccc)
{ {
_LightCache[i].EnabledTouched = true; _LightCache[i].EnabledTouched = true;
touchRenderVariable (&(_LightCache[i])); touchRenderVariable (&(_LightCache[i]));
@ -514,7 +520,7 @@ void CDriverD3D::initRenderVariables()
for (i=0; i<MaxTexture; i++) for (i=0; i<MaxTexture; i++)
{ {
_TexturePtrStateCache[i].StageID = i; _TexturePtrStateCache[i].StageID = i;
*(uint32*)&(_TexturePtrStateCache[i].Texture) = 0xcccccccc; *(uintptr_t*)&(_TexturePtrStateCache[i].Texture) = 0xcccccccc;
_TexturePtrStateCache[i].Modified = false; _TexturePtrStateCache[i].Modified = false;
} }
for (i=0; i<MaxSampler; i++) for (i=0; i<MaxSampler; i++)
@ -543,7 +549,7 @@ void CDriverD3D::initRenderVariables()
for (i=0; i<MaxLight; ++i) for (i=0; i<MaxLight; ++i)
{ {
_LightCache[i].LightIndex = uint8(i); _LightCache[i].LightIndex = uint8(i);
*(uint32*)&(_LightCache[i].Light) = 0xcccccccc; *(uintptr_t*)&(_LightCache[i].Light) = 0xcccccccc;
_LightCache[i].Modified = false; _LightCache[i].Modified = false;
} }
_VertexProgramCache.Modified = false; _VertexProgramCache.Modified = false;
@ -1063,7 +1069,7 @@ void CDriverD3D::updateRenderVariablesInternal()
// *************************************************************************** // ***************************************************************************
static void D3DWndProc(CDriverD3D *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) void D3DWndProc(CDriverD3D *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
H_AUTO_D3D(D3DWndProc); H_AUTO_D3D(D3DWndProc);
@ -1231,7 +1237,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
// *************************************************************************** // ***************************************************************************
bool CDriverD3D::init (uint windowIcon, emptyProc exitFunc) bool CDriverD3D::init (uintptr_t windowIcon, emptyProc exitFunc)
{ {
H_AUTO_D3D(CDriver3D_init ); H_AUTO_D3D(CDriver3D_init );
@ -1481,7 +1487,7 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
break; break;
} }
} }
#endif WITH_PERFHUD #endif /* WITH_PERFHUD */
// Create the D3D device // Create the D3D device
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE, &parameters, &_DeviceInterface); HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE, &parameters, &_DeviceInterface);
if (result != D3D_OK) if (result != D3D_OK)

@ -1,2 +1,4 @@
EXPORTS NL3D_createIDriverInstance LIBRARY nel_drv_direct3d_win_r
EXPORTS NL3D_interfaceVersion EXPORTS
NL3D_createIDriverInstance
NL3D_interfaceVersion

@ -839,7 +839,7 @@ public:
// *************************************************************************** // ***************************************************************************
// Mode initialisation, requests // Mode initialisation, requests
virtual bool init (uint windowIcon = 0, emptyProc exitFunc = 0); virtual bool init (uintptr_t windowIcon = 0, emptyProc exitFunc = 0);
virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay); virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay);
virtual bool release(); virtual bool release();
virtual bool setMode(const GfxMode& mode); virtual bool setMode(const GfxMode& mode);
@ -953,7 +953,7 @@ public:
virtual void setSwapVBLInterval(uint interval); virtual void setSwapVBLInterval(uint interval);
virtual uint getSwapVBLInterval(); virtual uint getSwapVBLInterval();
virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1); virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1);
virtual uint getTextureHandle(const ITexture&tex); virtual uintptr_t getTextureHandle(const ITexture&tex);
// Matrix, viewport and frustum // Matrix, viewport and frustum
virtual void setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective = true); virtual void setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective = true);
@ -1893,7 +1893,7 @@ public:
H_AUTO_D3D(CDriverD3D_setSamplerState); H_AUTO_D3D(CDriverD3D_setSamplerState);
nlassert (_DeviceInterface); nlassert (_DeviceInterface);
nlassert (sampler<MaxSampler); nlassert (sampler<MaxSampler);
nlassert (samplerState<MaxSamplerState); nlassert ((int)samplerState<(int)MaxSamplerState);
// Ref on the state // Ref on the state
CSamplerState &_samplerState = _SamplerStateCache[sampler][samplerState]; CSamplerState &_samplerState = _SamplerStateCache[sampler][samplerState];
@ -2025,7 +2025,7 @@ public:
// Remap high matrices indexes // Remap high matrices indexes
type = (D3DTRANSFORMSTATETYPE)remapMatrixIndex (type); type = (D3DTRANSFORMSTATETYPE)remapMatrixIndex (type);
nlassert (type<MaxMatrixState); nlassert ((int)type<(int)MaxMatrixState);
CMatrixState &theMatrix = _MatrixCache[type]; CMatrixState &theMatrix = _MatrixCache[type];
#ifdef NL_D3D_USE_RENDER_STATE_CACHE #ifdef NL_D3D_USE_RENDER_STATE_CACHE

@ -46,7 +46,7 @@ CIBDrvInfosD3D::CIBDrvInfosD3D(CDriverD3D *drv, ItIBDrvInfoPtrList it, CIndexBuf
// *************************************************************************** // ***************************************************************************
extern uint indexCount=0; uint indexCount=0;
CIBDrvInfosD3D::~CIBDrvInfosD3D() CIBDrvInfosD3D::~CIBDrvInfosD3D()
{ {

@ -1091,7 +1091,7 @@ void CDriverD3D::swapTextureHandle(ITexture &tex0, ITexture &tex1)
// *************************************************************************** // ***************************************************************************
uint CDriverD3D::getTextureHandle(const ITexture &tex) uintptr_t CDriverD3D::getTextureHandle(const ITexture &tex)
{ {
H_AUTO_D3D(CDriverD3D_getTextureHandle) H_AUTO_D3D(CDriverD3D_getTextureHandle)
// If DrvShare not setuped // If DrvShare not setuped
@ -1104,7 +1104,7 @@ uint CDriverD3D::getTextureHandle(const ITexture &tex)
if(!d3dtext) if(!d3dtext)
return 0; return 0;
return (uint)(d3dtext->Texture); return (uintptr_t)(d3dtext->Texture);
} }
// *************************************************************************** // ***************************************************************************

@ -59,7 +59,7 @@ CVBDrvInfosD3D::CVBDrvInfosD3D(CDriverD3D *drv, ItVBDrvInfoPtrList it, CVertexBu
// *************************************************************************** // ***************************************************************************
extern uint vertexCount=0; uint vertexCount=0;
CVBDrvInfosD3D::~CVBDrvInfosD3D() CVBDrvInfosD3D::~CVBDrvInfosD3D()
{ {
@ -173,7 +173,7 @@ uint8 *CVBDrvInfosD3D::lock (uint begin, uint end, bool readOnly)
void *pbData; void *pbData;
if (VertexBuffer->Lock ( begin, end-begin, &pbData, readOnly?D3DLOCK_READONLY:0) != D3D_OK) if (VertexBuffer->Lock ( begin, end-begin, &pbData, readOnly?D3DLOCK_READONLY:0) != D3D_OK)
return false; return NULL;
// Lock Profile? // Lock Profile?
if(driver->_VBHardProfiling /*&& Hardware*/) if(driver->_VBHardProfiling /*&& Hardware*/)

@ -19,7 +19,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif #endif

@ -37,7 +37,7 @@ NL_ADD_RUNTIME_FLAGS(${NLDRV_OGL_LIB})
IF(WIN32) IF(WIN32)
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY})
ADD_DEFINITIONS(/DDRIVER_OPENGL_EXPORTS) ADD_DEFINITIONS(-DDRIVER_OPENGL_EXPORTS)
ENDIF(WIN32) ENDIF(WIN32)
IF(APPLE) IF(APPLE)

@ -108,7 +108,10 @@ IDriver* createGlDriverInstance ()
#else #else
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#ifdef NL_COMP_MINGW
extern "C"
{
#endif
__declspec(dllexport) IDriver* NL3D_createIDriverInstance () __declspec(dllexport) IDriver* NL3D_createIDriverInstance ()
{ {
return new CDriverGL; return new CDriverGL;
@ -118,7 +121,9 @@ __declspec(dllexport) uint32 NL3D_interfaceVersion ()
{ {
return IDriver::InterfaceVersion; return IDriver::InterfaceVersion;
} }
#ifdef NL_COMP_MINGW
}
#endif
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
extern "C" extern "C"

@ -1,2 +1,4 @@
EXPORTS NL3D_createIDriverInstance LIBRARY nel_drv_opengl_win_r
EXPORTS NL3D_interfaceVersion EXPORTS
NL3D_createIDriverInstance
NL3D_interfaceVersion

@ -304,7 +304,7 @@ public:
virtual bool isLost() const { return false; } // there's no notion of 'lost device" in OpenGL virtual bool isLost() const { return false; } // there's no notion of 'lost device" in OpenGL
virtual bool init (uint windowIcon = 0, emptyProc exitFunc = 0); virtual bool init (uintptr_t windowIcon = 0, emptyProc exitFunc = 0);
virtual void disableHardwareVertexProgram(); virtual void disableHardwareVertexProgram();
virtual void disableHardwarePixelProgram(); virtual void disableHardwarePixelProgram();
@ -632,7 +632,7 @@ public:
virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1); virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1);
virtual uint getTextureHandle(const ITexture&tex); virtual uintptr_t getTextureHandle(const ITexture&tex);
/// \name Material multipass. /// \name Material multipass.
/** NB: setupMaterial() must be called before thoses methods. /** NB: setupMaterial() must be called before thoses methods.

@ -2269,7 +2269,7 @@ void CDriverGL::swapTextureHandle(ITexture &tex0, ITexture &tex1)
// *************************************************************************** // ***************************************************************************
uint CDriverGL::getTextureHandle(const ITexture &tex) uintptr_t CDriverGL::getTextureHandle(const ITexture &tex)
{ {
H_AUTO_OGL(CDriverGL_getTextureHandle) H_AUTO_OGL(CDriverGL_getTextureHandle)
// If DrvShare not setuped // If DrvShare not setuped

@ -296,7 +296,7 @@ bool GlWndProc(CDriverGL *driver, XEvent &e)
#endif // NL_OS_UNIX #endif // NL_OS_UNIX
// *************************************************************************** // ***************************************************************************
bool CDriverGL::init (uint windowIcon, emptyProc exitFunc) bool CDriverGL::init (uintptr_t windowIcon, emptyProc exitFunc)
{ {
H_AUTO_OGL(CDriverGL_init) H_AUTO_OGL(CDriverGL_init)

@ -37,7 +37,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# include <windowsx.h> # include <windowsx.h>
#endif #endif

@ -82,13 +82,13 @@ void UDriver::setMatrixMode2D43()
} }
// *************************************************************************** // ***************************************************************************
UDriver *UDriver::createDriver(uint windowIcon, bool direct3d, emptyProc exitFunc) UDriver *UDriver::createDriver(uintptr_t windowIcon, bool direct3d, emptyProc exitFunc)
{ {
return new CDriverUser (windowIcon, direct3d ? CDriverUser::Direct3d:CDriverUser::OpenGl, exitFunc); return new CDriverUser (windowIcon, direct3d ? CDriverUser::Direct3d:CDriverUser::OpenGl, exitFunc);
} }
// *************************************************************************** // ***************************************************************************
UDriver *UDriver::createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc) UDriver *UDriver::createDriver(uintptr_t windowIcon, TDriver driver, emptyProc exitFunc)
{ {
return new CDriverUser (windowIcon, (CDriverUser::TDriver)driver, exitFunc); return new CDriverUser (windowIcon, (CDriverUser::TDriver)driver, exitFunc);
} }
@ -114,7 +114,7 @@ bool CDriverUser::_StaticInit= false;
// *************************************************************************** // ***************************************************************************
CDriverUser::CDriverUser (uint windowIcon, TDriver driver, emptyProc exitFunc) CDriverUser::CDriverUser (uintptr_t windowIcon, TDriver driver, emptyProc exitFunc)
{ {
// The enum of IDriver and UDriver MUST be the same!!! // The enum of IDriver and UDriver MUST be the same!!!
nlassert((uint)IDriver::idCount == (uint)UDriver::idCount); nlassert((uint)IDriver::idCount == (uint)UDriver::idCount);

@ -35,7 +35,9 @@
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#else // NL_OS_WINDOWS #else // NL_OS_WINDOWS
# include <dlfcn.h> # include <dlfcn.h>

@ -37,7 +37,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# include <winbase.h> # include <winbase.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -63,6 +63,8 @@
#include "nel/misc/file.h" #include "nel/misc/file.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#define NOMINMAX #ifndef NL_COMP_MINGW
#define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#endif #endif

@ -25,7 +25,9 @@
#include "nel/misc/o_xml.h" #include "nel/misc/o_xml.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#ifndef NL_COMP_MINGW
#define NOMINMAX #define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -27,7 +27,7 @@ ENDIF(WITH_STATIC OR WIN32)
# For DirectInput (di_event_emitter) # For DirectInput (di_event_emitter)
IF(WIN32) IF(WIN32)
INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(nelmisc ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY}) TARGET_LINK_LIBRARIES(nelmisc ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY} winmm dbghelp)
ENDIF(WIN32) ENDIF(WIN32)
IF(UNIX) IF(UNIX)
@ -39,7 +39,7 @@ ENDIF(UNIX)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${PNG_INCLUDE_DIR} config_file) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${PNG_INCLUDE_DIR} config_file)
TARGET_LINK_LIBRARIES(nelmisc ${CMAKE_THREAD_LIBS_INIT} ${LIBXML2_LIBRARIES}) TARGET_LINK_LIBRARIES(nelmisc ${CMAKE_THREAD_LIBS_INIT} ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARY})
SET_TARGET_PROPERTIES(nelmisc PROPERTIES LINK_INTERFACE_LIBRARIES "") SET_TARGET_PROPERTIES(nelmisc PROPERTIES LINK_INTERFACE_LIBRARIES "")
NL_DEFAULT_PROPS(nelmisc "NeL, Library: NeL Misc") NL_DEFAULT_PROPS(nelmisc "NeL, Library: NeL Misc")
NL_ADD_RUNTIME_FLAGS(nelmisc) NL_ADD_RUNTIME_FLAGS(nelmisc)

@ -26,6 +26,9 @@
#include <csetjmp> #include <csetjmp>
extern "C" extern "C"
{ {
#ifdef NL_COMP_MINGW
# define HAVE_BOOLEAN
#endif
#include <jpeglib.h> #include <jpeglib.h>
} }
#endif #endif

@ -53,7 +53,9 @@
# define _WIN32_WINNT 0x0400 # define _WIN32_WINNT 0x0400
# endif # endif
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
# define NL_WIN_CALLBACK # define NL_WIN_CALLBACK

@ -20,7 +20,9 @@
#include "nel/misc/common.h" #include "nel/misc/common.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# include <io.h> # include <io.h>
# include <tchar.h> # include <tchar.h>
@ -37,6 +39,7 @@
using namespace std; using namespace std;
#ifndef NL_COMP_MINGW
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# pragma message( " " ) # pragma message( " " )
@ -69,6 +72,7 @@ extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
#endif // !NL_COMP_MINGW
#ifdef NL_HAS_SSE2 #ifdef NL_HAS_SSE2
@ -1069,7 +1073,7 @@ bool openDoc (const char *document)
HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL,NULL, SW_SHOWDEFAULT); HINSTANCE result = ShellExecuteA(NULL, "open", document, NULL,NULL, SW_SHOWDEFAULT);
// If it failed, get the .htm regkey and lookup the program // If it failed, get the .htm regkey and lookup the program
if ((UINT)result <= HINSTANCE_ERROR) if ((uintptr_t)result <= HINSTANCE_ERROR)
{ {
if (GetRegKey(HKEY_CLASSES_ROOT, ext.c_str(), key) == ERROR_SUCCESS) if (GetRegKey(HKEY_CLASSES_ROOT, ext.c_str(), key) == ERROR_SUCCESS)
{ {

@ -34,8 +34,10 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define _WIN32_WINDOWS 0x0410 # define _WIN32_WINDOWS 0x0410
# ifndef NL_COMP_MINGW
# define WINVER 0x0400 # define WINVER 0x0400
# define NOMINMAX # define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# include <direct.h> # include <direct.h>
# include <tchar.h> # include <tchar.h>
@ -445,7 +447,7 @@ public:
EDebug() { _Reason = "Nothing about EDebug"; } EDebug() { _Reason = "Nothing about EDebug"; }
~EDebug () { } virtual ~EDebug() throw() {}
EDebug(EXCEPTION_POINTERS * pexp) : m_pexp(pexp) { nlassert(pexp != 0); createWhat(); } EDebug(EXCEPTION_POINTERS * pexp) : m_pexp(pexp) { nlassert(pexp != 0); createWhat(); }
EDebug(const EDebug& se) : m_pexp(se.m_pexp) { createWhat(); } EDebug(const EDebug& se) : m_pexp(se.m_pexp) { createWhat(); }
@ -755,7 +757,7 @@ public:
HANDLE getProcessHandle() HANDLE getProcessHandle()
{ {
return CSystemInfo::isNT()?GetCurrentProcess():(HANDLE)GetCurrentProcessId(); return CSystemInfo::isNT()?GetCurrentProcess():(HANDLE)(uintptr_t)GetCurrentProcessId();
} }
// return true if found // return true if found
@ -797,7 +799,7 @@ public:
while (findAndErase(rawType, "classvector<char,class char_traits<char>,class allocator<char> >", "string")) ; while (findAndErase(rawType, "classvector<char,class char_traits<char>,class allocator<char> >", "string")) ;
} }
string getFuncInfo (DWORD funcAddr, DWORD stackAddr) string getFuncInfo (uintptr_t funcAddr, uintptr_t stackAddr)
{ {
string str ("NoSymbol"); string str ("NoSymbol");
@ -853,7 +855,7 @@ public:
if (stop==0 && (parse[i] == ',' || parse[i] == ')')) if (stop==0 && (parse[i] == ',' || parse[i] == ')'))
{ {
ULONG *addr = (ULONG*)(stackAddr) + 2 + pos2++; uintptr_t *addr = (uintptr_t*)(stackAddr) + 2 + pos2++;
string displayType = type; string displayType = type;
cleanType (type, displayType); cleanType (type, displayType);
@ -882,7 +884,7 @@ public:
} }
else if (type == "char*") else if (type == "char*")
{ {
if (!IsBadReadPtr(addr,sizeof(char*)) && *addr != NULL) if (!IsBadReadPtr(addr,sizeof(char*)) && *addr != 0)
{ {
if (!IsBadStringPtrA((char*)*addr,32)) if (!IsBadStringPtrA((char*)*addr,32))
{ {
@ -920,7 +922,7 @@ public:
{ {
if (!IsBadReadPtr(addr,sizeof(string*))) if (!IsBadReadPtr(addr,sizeof(string*)))
{ {
if (*addr != NULL) if (*addr != 0)
{ {
if (!IsBadReadPtr((void*)*addr,sizeof(string))) if (!IsBadReadPtr((void*)*addr,sizeof(string)))
sprintf (tmp, "\"%s\"", ((string*)*addr)->c_str()); sprintf (tmp, "\"%s\"", ((string*)*addr)->c_str());
@ -929,9 +931,9 @@ public:
} }
else else
{ {
if (!IsBadReadPtr(addr,sizeof(ULONG*))) if (!IsBadReadPtr(addr,sizeof(uintptr_t*)))
{ {
if(*addr == NULL) if(*addr == 0)
sprintf (tmp, "<NULL>"); sprintf (tmp, "<NULL>");
else else
sprintf (tmp, "0x%p", *addr); sprintf (tmp, "0x%p", *addr);
@ -956,7 +958,7 @@ public:
if (disp != 0) if (disp != 0)
{ {
str += " + "; str += " + ";
str += toString ((uint32)disp); str += toString ((uintptr_t)disp);
str += " bytes"; str += " bytes";
} }
} }
@ -1166,7 +1168,8 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog)
initAcquireTimeMap(); initAcquireTimeMap();
#endif #endif
#ifdef NL_OS_WINDOWS #ifndef NL_COMP_MINGW
# ifdef NL_OS_WINDOWS
// if (!IsDebuggerPresent ()) // if (!IsDebuggerPresent ())
{ {
// Use an environment variable to share the value among the EXE and its child DLLs // Use an environment variable to share the value among the EXE and its child DLLs
@ -1180,7 +1183,8 @@ void createDebug (const char *logPath, bool logInFile, bool eraseLastLog)
SetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, _T("1") ); SetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, _T("1") );
} }
} }
#endif // NL_OS_WINDOWS # endif // NL_OS_WINDOWS
#endif //!NL_COMP_MINGW
INelContext::getInstance().setErrorLog(new CLog (CLog::LOG_ERROR)); INelContext::getInstance().setErrorLog(new CLog (CLog::LOG_ERROR));
INelContext::getInstance().setWarningLog(new CLog (CLog::LOG_WARNING)); INelContext::getInstance().setWarningLog(new CLog (CLog::LOG_WARNING));

@ -217,7 +217,7 @@ static void BuildCtrlName(LPCDIDEVICEOBJECTINSTANCE lpddoi,
//============================================================================ //============================================================================
// A callback to enumerate the controls of a device // A callback to enumerate the controls of a device
static BOOL CALLBACK DIEnumDeviceObjectsCallback BOOL CALLBACK DIEnumDeviceObjectsCallback
( (
LPCDIDEVICEOBJECTINSTANCE lpddoi, LPCDIDEVICEOBJECTINSTANCE lpddoi,
LPVOID pvRef LPVOID pvRef

@ -113,8 +113,8 @@ static const CKeyConv DIToNel[] =
{DIK_CONVERT, KeyCONVERT, "CONVERT", false}, {DIK_CONVERT, KeyCONVERT, "CONVERT", false},
{DIK_NOCONVERT, KeyNONCONVERT, "NOCONVERT", true}, {DIK_NOCONVERT, KeyNONCONVERT, "NOCONVERT", true},
// //
{DIK_KANA, KeyKANA, false}, {DIK_KANA, KeyKANA, "KANA", false},
{DIK_KANJI, KeyKANJI, false}, {DIK_KANJI, KeyKANJI, "KANJI", false},
}; };
@ -164,7 +164,7 @@ CDIKeyboard::CDIKeyboard(CWinEventEmitter *we, HWND hwnd)
_RepeatPeriod = (uint) (1000.f / (keybSpeed * (27.5f / 31.f) + 2.5f)); _RepeatPeriod = (uint) (1000.f / (keybSpeed * (27.5f / 31.f) + 2.5f));
} }
// get keyboard layout // get keyboard layout
_KBLayout = ::GetKeyboardLayout(NULL); _KBLayout = ::GetKeyboardLayout(0);
_RepetitionDisabled.resize(NumKeys); _RepetitionDisabled.resize(NumKeys);
_RepetitionDisabled.clearAll(); _RepetitionDisabled.clearAll();

@ -27,6 +27,12 @@
#define new DEBUG_NEW #define new DEBUG_NEW
#endif #endif
#ifdef NL_COMP_MINGW
# undef FIELD_OFFSET
# define FIELD_OFFSET(t,f) offsetof(t,f)
#endif
namespace NLMISC namespace NLMISC
{ {
@ -78,7 +84,7 @@ void CDIMouse::setMouseMode(TAxis axis, TAxisMode axisMode)
//====================================================== //======================================================
CDIMouse::TAxisMode CDIMouse::getMouseMode(TAxis axis) const CDIMouse::TAxisMode CDIMouse::getMouseMode(TAxis axis) const
{ {
nlassert(axis < NumMouseAxis); nlassert((int)axis < (int)NumMouseAxis);
return _MouseAxisMode[axis]; return _MouseAxisMode[axis];
} }

@ -39,8 +39,10 @@
// these defines is for IsDebuggerPresent(). it'll not compile on windows 95 // these defines is for IsDebuggerPresent(). it'll not compile on windows 95
// just comment this and the IsDebuggerPresent to compile on windows 95 // just comment this and the IsDebuggerPresent to compile on windows 95
# define _WIN32_WINDOWS 0x0410 # define _WIN32_WINDOWS 0x0410
# define WINVER 0x0400 # ifndef NL_COMP_MINGW
# define NOMINMAX # define WINVER 0x0400
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#else #else
# define IsDebuggerPresent() false # define IsDebuggerPresent() false

@ -57,7 +57,7 @@ void *nlGetSymbolAddress(NL_LIB_HANDLE libHandle, const std::string &procName)
{ {
void *res = 0; void *res = 0;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
res = GetProcAddress(libHandle, procName.c_str()); res = (void *)GetProcAddress(libHandle, procName.c_str());
#elif defined(NL_OS_UNIX) #elif defined(NL_OS_UNIX)
res = dlsym(libHandle, procName.c_str()); res = dlsym(libHandle, procName.c_str());
#else #else

@ -19,7 +19,9 @@
#include "nel/misc/log.h" #include "nel/misc/log.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <process.h> # include <process.h>
# include <windows.h> # include <windows.h>
#else #else

@ -24,7 +24,9 @@
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# include <imagehlp.h> # include <imagehlp.h>
# pragma comment(lib, "imagehlp.lib") # pragma comment(lib, "imagehlp.lib")
@ -148,7 +150,7 @@ static string getSourceInfo (DWORD_TYPE addr)
return str; return str;
} }
static DWORD_TYPE __stdcall GetModuleBase(HANDLE hProcess, DWORD_TYPE dwReturnAddress) static uintptr_t __stdcall GetModuleBase(HANDLE hProcess, uintptr_t dwReturnAddress)
{ {
IMAGEHLP_MODULE moduleInfo; IMAGEHLP_MODULE moduleInfo;
@ -169,9 +171,15 @@ static DWORD_TYPE __stdcall GetModuleBase(HANDLE hProcess, DWORD_TYPE dwReturnAd
if (cch && (lstrcmp(szFile, "DBFN")== 0)) if (cch && (lstrcmp(szFile, "DBFN")== 0))
{ {
if (!SymLoadModule(hProcess, char mn[] = { 'M', 'N', 0x00 };
NULL, "MN", #ifdef NL_OS_WIN64
NULL, (DWORD) memoryBasicInfo.AllocationBase, 0)) if (!SymLoadModule64(
#else
if (!SymLoadModule(
#endif
hProcess,
NULL, mn,
NULL, (uintptr_t)memoryBasicInfo.AllocationBase, 0))
{ {
// DWORD dwError = GetLastError(); // DWORD dwError = GetLastError();
// nlinfo("Error: %d", dwError); // nlinfo("Error: %d", dwError);
@ -179,17 +187,23 @@ static DWORD_TYPE __stdcall GetModuleBase(HANDLE hProcess, DWORD_TYPE dwReturnAd
} }
else else
{ {
if (!SymLoadModule(hProcess, #ifdef NL_OS_WIN64
NULL, ((cch) ? szFile : NULL), if (!SymLoadModule64(
NULL, (DWORD) memoryBasicInfo.AllocationBase, 0)) #else
if (!SymLoadModule(
#endif
hProcess,
NULL, ((cch) ? szFile : NULL),
NULL, (uintptr_t)memoryBasicInfo.AllocationBase, 0))
{ {
// DWORD dwError = GetLastError(); // DWORD dwError = GetLastError();
// nlinfo("Error: %d", dwError); // nlinfo("Error: %d", dwError);
} }
} }
return (DWORD) memoryBasicInfo.AllocationBase; return (uintptr_t)memoryBasicInfo.AllocationBase;
} }
// else // else
// nlinfo("Error is %d", GetLastError()); // nlinfo("Error is %d", GetLastError());
@ -250,19 +264,13 @@ static void displayCallStack (CLog *log)
return; return;
} }
#ifdef NL_OS_WIN64 // FIXME: Implement this for MinGW
WOW64_CONTEXT context; #ifndef NL_COMP_MINGW
#else
CONTEXT context; CONTEXT context;
#endif
::ZeroMemory (&context, sizeof(context)); ::ZeroMemory (&context, sizeof(context));
context.ContextFlags = CONTEXT_FULL; context.ContextFlags = CONTEXT_FULL;
#ifdef NL_OS_WIN64
if (Wow64GetThreadContext (GetCurrentThread(), &context) == FALSE)
#else
if (GetThreadContext (GetCurrentThread(), &context) == FALSE) if (GetThreadContext (GetCurrentThread(), &context) == FALSE)
#endif
{ {
nlwarning ("DISP: GetThreadContext(%p) failed", GetCurrentThread()); nlwarning ("DISP: GetThreadContext(%p) failed", GetCurrentThread());
return; return;
@ -309,6 +317,7 @@ static void displayCallStack (CLog *log)
log->displayNL (" %s : %s", srcInfo.c_str(), symInfo.c_str()); log->displayNL (" %s : %s", srcInfo.c_str(), symInfo.c_str());
} }
#endif
} }
#else // NL_OS_WINDOWS #else // NL_OS_WINDOWS

@ -44,8 +44,10 @@ using namespace std;
// these defines are for IsDebuggerPresent(). It'll not compile on windows 95 // these defines are for IsDebuggerPresent(). It'll not compile on windows 95
// just comment this and the IsDebuggerPresent to compile on windows 95 // just comment this and the IsDebuggerPresent to compile on windows 95
#define _WIN32_WINDOWS 0x0410 #define _WIN32_WINDOWS 0x0410
#define WINVER 0x0400 #ifndef NL_COMP_MINGW
#define NOMINMAX # define WINVER 0x0400
# define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#ifdef DEBUG_NEW #ifdef DEBUG_NEW

@ -25,7 +25,9 @@
#include "nel/misc/xml_pack.h" #include "nel/misc/xml_pack.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# include <sys/types.h> # include <sys/types.h>
# include <sys/stat.h> # include <sys/stat.h>

@ -23,7 +23,9 @@
#include "nel/misc/path.h" #include "nel/misc/path.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# include <windowsx.h> # include <windowsx.h>
# include <winuser.h> # include <winuser.h>
@ -157,8 +159,10 @@ static LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM
// if the dtor call order is not good. // if the dtor call order is not good.
//exit(EXIT_SUCCESS); //exit(EXIT_SUCCESS);
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#ifndef NL_COMP_MINGW
// disable the Windows popup telling that the application aborted and disable the dr watson report. // disable the Windows popup telling that the application aborted and disable the dr watson report.
_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
#endif #endif
// quit without calling atexit or static object dtors. // quit without calling atexit or static object dtors.
abort(); abort();
@ -232,7 +236,7 @@ TReportResult report (const std::string &title, const std::string &header, const
// create the edit control // create the edit control
HWND edit = CreateWindowW (L"EDIT", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_LEFT | ES_MULTILINE, 7, 70, 429, 212, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); HWND edit = CreateWindowW (L"EDIT", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_READONLY | ES_LEFT | ES_MULTILINE, 7, 70, 429, 212, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (edit, WM_SETFONT, (LONG) font, TRUE); SendMessage (edit, WM_SETFONT, (WPARAM) font, TRUE);
// set the edit text limit to lot of :) // set the edit text limit to lot of :)
SendMessage (edit, EM_LIMITTEXT, ~0U, 0); SendMessage (edit, EM_LIMITTEXT, ~0U, 0);
@ -246,7 +250,7 @@ TReportResult report (const std::string &title, const std::string &header, const
{ {
// create the combo box control // create the combo box control
checkIgnore = CreateWindowW (L"BUTTON", L"Don't display this report again", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_CHECKBOX, 7, 290, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); checkIgnore = CreateWindowW (L"BUTTON", L"Don't display this report again", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_CHECKBOX, 7, 290, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (checkIgnore, WM_SETFONT, (LONG) font, TRUE); SendMessage (checkIgnore, WM_SETFONT, (WPARAM) font, TRUE);
if(ignoreNextTime) if(ignoreNextTime)
{ {
@ -256,28 +260,28 @@ TReportResult report (const std::string &title, const std::string &header, const
// create the debug button control // create the debug button control
debug = CreateWindowW (L"BUTTON", L"Debug", WS_CHILD | WS_VISIBLE, 7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); debug = CreateWindowW (L"BUTTON", L"Debug", WS_CHILD | WS_VISIBLE, 7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (debug, WM_SETFONT, (LONG) font, TRUE); SendMessage (debug, WM_SETFONT, (WPARAM) font, TRUE);
if (debugButton == 0) if (debugButton == 0)
EnableWindow(debug, FALSE); EnableWindow(debug, FALSE);
// create the ignore button control // create the ignore button control
ignore = CreateWindowW (L"BUTTON", L"Ignore", WS_CHILD | WS_VISIBLE, 75+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); ignore = CreateWindowW (L"BUTTON", L"Ignore", WS_CHILD | WS_VISIBLE, 75+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (ignore, WM_SETFONT, (LONG) font, TRUE); SendMessage (ignore, WM_SETFONT, (WPARAM) font, TRUE);
if (ignoreButton == 0) if (ignoreButton == 0)
EnableWindow(ignore, FALSE); EnableWindow(ignore, FALSE);
// create the quit button control // create the quit button control
quit = CreateWindowW (L"BUTTON", L"Quit", WS_CHILD | WS_VISIBLE, 75+75+7+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); quit = CreateWindowW (L"BUTTON", L"Quit", WS_CHILD | WS_VISIBLE, 75+75+7+7+7, 315, 75, 25, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (quit, WM_SETFONT, (LONG) font, TRUE); SendMessage (quit, WM_SETFONT, (WPARAM) font, TRUE);
if (quitButton == 0) if (quitButton == 0)
EnableWindow(quit, FALSE); EnableWindow(quit, FALSE);
// create the debug button control // create the debug button control
sendReport = CreateWindowW (L"BUTTON", L"Don't send the report", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 7, 315+32, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); sendReport = CreateWindowW (L"BUTTON", L"Don't send the report", WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, 7, 315+32, 429, 18, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (sendReport, WM_SETFONT, (LONG) font, TRUE); SendMessage (sendReport, WM_SETFONT, (WPARAM) font, TRUE);
string formatedHeader; string formatedHeader;
if (header.empty()) if (header.empty())
@ -302,7 +306,7 @@ TReportResult report (const std::string &title, const std::string &header, const
// create the label control // create the label control
HWND label = CreateWindowW (L"STATIC", (LPCWSTR)uc.c_str(), WS_CHILD | WS_VISIBLE /*| SS_WHITERECT*/, 7, 7, 429, 51, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL); HWND label = CreateWindowW (L"STATIC", (LPCWSTR)uc.c_str(), WS_CHILD | WS_VISIBLE /*| SS_WHITERECT*/, 7, 7, 429, 51, dialog, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(dialog, GWLP_HINSTANCE), NULL);
SendMessage (label, WM_SETFONT, (LONG) font, TRUE); SendMessage (label, WM_SETFONT, (WPARAM) font, TRUE);
DebugDefaultBehavior = debugButton==1; DebugDefaultBehavior = debugButton==1;

@ -20,7 +20,9 @@
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#else #else
# include <sys/types.h> # include <sys/types.h>

@ -43,9 +43,11 @@
#include <vector> #include <vector>
#ifdef _WIN32 #ifdef _WIN32
#define NOMINMAX # ifndef __MINGW32__
#include <WinSock2.h> #define NOMINMAX
#include <windows.h> # endif
# include <WinSock2.h>
# include <windows.h>
#endif #endif
#endif // NL_STDMISC_H #endif // NL_STDMISC_H

@ -19,7 +19,9 @@
#include "nel/misc/system_info.h" #include "nel/misc/system_info.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# include <WinNT.h> # include <WinNT.h>
# include <tchar.h> # include <tchar.h>
@ -1484,7 +1486,8 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion)
{ {
VS_FIXEDFILEINFO *info; VS_FIXEDFILEINFO *info;
UINT len; UINT len;
if (_VerQueryValue(&buffer[0], "\\", (VOID**)&info, &len)) char bslash[] = { '\\', 0x00 };
if (_VerQueryValue(&buffer[0], bslash, (VOID**)&info, &len))
{ {
driverVersion = (((uint64)info->dwFileVersionMS)<<32)|info->dwFileVersionLS; driverVersion = (((uint64)info->dwFileVersionMS)<<32)|info->dwFileVersionLS;
return true; return true;

@ -18,7 +18,9 @@
#include "nel/misc/system_utils.h" #include "nel/misc/system_utils.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#define NOMINMAX #ifndef NL_COMP_MINGW
#define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#ifdef _WIN32_WINNT_WIN7 #ifdef _WIN32_WINNT_WIN7
@ -222,7 +224,7 @@ bool CSystemUtils::supportUnicode()
bool CSystemUtils::isAzertyKeyboard() bool CSystemUtils::isAzertyKeyboard()
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
uint16 klId = uint16((uint32)GetKeyboardLayout(0) & 0xFFFF); uint16 klId = uint16((uintptr_t)GetKeyboardLayout(0) & 0xFFFF);
// 0x040c is French, 0x080c is Belgian // 0x040c is French, 0x080c is Belgian
if (klId == 0x040c || klId == 0x080c) if (klId == 0x040c || klId == 0x080c)
return true; return true;
@ -312,7 +314,8 @@ bool CSystemUtils::setRegKey(const string &ValueName, const string &Value)
HKEY hkey; HKEY hkey;
DWORD dwDisp; DWORD dwDisp;
if (RegCreateKeyExA(HKEY_CURRENT_USER, RootKey.c_str(), 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisp) == ERROR_SUCCESS) char nstr[] = { 0x00 };
if (RegCreateKeyExA(HKEY_CURRENT_USER, RootKey.c_str(), 0, nstr, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwDisp) == ERROR_SUCCESS)
{ {
if (RegSetValueExA(hkey, ValueName.c_str(), 0L, REG_SZ, (const BYTE *)Value.c_str(), (DWORD)(Value.size())+1) == ERROR_SUCCESS) if (RegSetValueExA(hkey, ValueName.c_str(), 0L, REG_SZ, (const BYTE *)Value.c_str(), (DWORD)(Value.size())+1) == ERROR_SUCCESS)
res = true; res = true;

@ -20,7 +20,9 @@
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -21,7 +21,9 @@
#include "nel/misc/thread.h" #include "nel/misc/thread.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
# include <sys/time.h> # include <sys/time.h>

@ -18,8 +18,9 @@
#include "nel/misc/win_displayer.h" #include "nel/misc/win_displayer.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#ifndef NL_COMP_MINGW
#define NOMINMAX # define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include <winuser.h> #include <winuser.h>
@ -263,7 +264,7 @@ void CWinDisplayer::updateLabels ()
{ {
access.value()[i].Hwnd = CreateWindowW (L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_SIMPLE, 0, 0, 0, 0, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL); access.value()[i].Hwnd = CreateWindowW (L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_SIMPLE, 0, 0, 0, 0, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
} }
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETFONT, (LONG) _HFont, TRUE); SendMessage ((HWND)access.value()[i].Hwnd, WM_SETFONT, (WPARAM)_HFont, TRUE);
needResize = true; needResize = true;
} }
@ -285,7 +286,7 @@ void CWinDisplayer::updateLabels ()
} }
} }
SendMessage ((HWND)access.value()[i].Hwnd, WM_SETTEXT, 0, (LONG) n.c_str()); SendMessage ((HWND)access.value()[i].Hwnd, WM_SETTEXT, 0, (LPARAM) n.c_str());
access.value()[i].NeedUpdate = false; access.value()[i].NeedUpdate = false;
} }
} }
@ -422,7 +423,7 @@ void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint
dwStyle |= WS_HSCROLL; dwStyle |= WS_HSCROLL;
_HEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", dwStyle, 0, _ToolBarHeight, w, h-_ToolBarHeight-_InputEditHeight, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL); _HEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", dwStyle, 0, _ToolBarHeight, w, h-_ToolBarHeight-_InputEditHeight, _HWnd, (HMENU) NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
SendMessage (_HEdit, WM_SETFONT, (LONG) _HFont, TRUE); SendMessage (_HEdit, WM_SETFONT, (WPARAM)_HFont, TRUE);
// set the edit text limit to lot of :) // set the edit text limit to lot of :)
SendMessage (_HEdit, EM_LIMITTEXT, -1, 0); SendMessage (_HEdit, EM_LIMITTEXT, -1, 0);
@ -436,7 +437,7 @@ void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint
_HInputEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", WS_CHILD | WS_VISIBLE _HInputEdit = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, RICHEDIT_CLASSW, L"", WS_CHILD | WS_VISIBLE
/*| ES_MULTILINE*/ | ES_WANTRETURN | ES_NOHIDESEL | ES_AUTOHSCROLL, 0, h-_InputEditHeight, w, _InputEditHeight, /*| ES_MULTILINE*/ | ES_WANTRETURN | ES_NOHIDESEL | ES_AUTOHSCROLL, 0, h-_InputEditHeight, w, _InputEditHeight,
_HWnd, NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL); _HWnd, NULL, (HINSTANCE) GetWindowLongPtr(_HWnd, GWLP_HINSTANCE), NULL);
SendMessageW (_HInputEdit, WM_SETFONT, (LONG) _HFont, TRUE); SendMessageW (_HInputEdit, WM_SETFONT, (WPARAM)_HFont, TRUE);
LRESULT dwEvent = SendMessageW(_HInputEdit, EM_GETEVENTMASK, (WPARAM)0, (LPARAM)0); LRESULT dwEvent = SendMessageW(_HInputEdit, EM_GETEVENTMASK, (WPARAM)0, (LPARAM)0);
dwEvent |= ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE; dwEvent |= ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE;
@ -486,7 +487,7 @@ void CWinDisplayer::clear ()
SendMessageW (_HEdit, EM_SETSEL, 0, nIndex); SendMessageW (_HEdit, EM_SETSEL, 0, nIndex);
// clear all the text // clear all the text
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LONG) ""); SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) "");
SendMessageW(_HEdit,EM_SETMODIFY,(WPARAM)TRUE,(LPARAM)0); SendMessageW(_HEdit,EM_SETMODIFY,(WPARAM)TRUE,(LPARAM)0);
@ -535,7 +536,7 @@ void CWinDisplayer::display_main ()
// store old selection // store old selection
DWORD startSel, endSel; DWORD startSel, endSel;
SendMessage (_HEdit, EM_GETSEL, (LONG)&startSel, (LONG)&endSel); SendMessage (_HEdit, EM_GETSEL, (WPARAM)&startSel, (LPARAM)&endSel);
// find how many lines we have to remove in the current output to add new lines // find how many lines we have to remove in the current output to add new lines
@ -549,7 +550,7 @@ void CWinDisplayer::display_main ()
if (nblineremove == _HistorySize) if (nblineremove == _HistorySize)
{ {
SendMessage (_HEdit, WM_SETTEXT, 0, (LONG) ""); SendMessage (_HEdit, WM_SETTEXT, 0, (LPARAM) "");
startSel = endSel = -1; startSel = endSel = -1;
} }
else else
@ -559,7 +560,7 @@ void CWinDisplayer::display_main ()
LRESULT oldIndex2 = SendMessageW (_HEdit, EM_LINEINDEX, nblineremove, 0); LRESULT oldIndex2 = SendMessageW (_HEdit, EM_LINEINDEX, nblineremove, 0);
//nlassert (oldIndex2 != -1); //nlassert (oldIndex2 != -1);
SendMessageW (_HEdit, EM_SETSEL, oldIndex1, oldIndex2); SendMessageW (_HEdit, EM_SETSEL, oldIndex1, oldIndex2);
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LONG) ""); SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) "");
// update the selection due to the erasing // update the selection due to the erasing
sint dt = (sint)(oldIndex2 - oldIndex1); sint dt = (sint)(oldIndex2 - oldIndex1);
@ -599,7 +600,7 @@ void CWinDisplayer::display_main ()
} }
// add the string to the edit control // add the string to the edit control
SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LONG) str.c_str()); SendMessageW (_HEdit, EM_REPLACESEL, FALSE, (LPARAM) str.c_str());
} }
// restore old selection // restore old selection

@ -22,7 +22,9 @@
#include "nel/misc/event_server.h" #include "nel/misc/event_server.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#ifndef NL_COMP_MINGW
#define NOMINMAX #define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>

@ -20,7 +20,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#include "nel/misc/path.h" #include "nel/misc/path.h"
#ifndef NL_COMP_MINGW
#define NOMINMAX #define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
#include <typeinfo> #include <typeinfo>

@ -24,7 +24,9 @@
#include "nel/net/net_log.h" #include "nel/net/net_log.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#elif defined NL_OS_UNIX #elif defined NL_OS_UNIX
# include <netinet/in.h> # include <netinet/in.h>

@ -22,7 +22,9 @@
#include "nel/net/net_log.h" #include "nel/net/net_log.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#elif defined NL_OS_UNIX #elif defined NL_OS_UNIX
# include <unistd.h> # include <unistd.h>

@ -25,7 +25,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#elif defined NL_OS_UNIX #elif defined NL_OS_UNIX
# include <netinet/in.h> # include <netinet/in.h>

@ -22,7 +22,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#define NOMINMAX #ifndef NL_COMP_MINGW
# define NOMINMAX
#endif
#include <windows.h> #include <windows.h>
typedef sint socklen_t; typedef sint socklen_t;

@ -24,8 +24,10 @@
// these defines is for IsDebuggerPresent(). it'll not compile on windows 95 // these defines is for IsDebuggerPresent(). it'll not compile on windows 95
// just comment this and the IsDebuggerPresent to compile on windows 95 // just comment this and the IsDebuggerPresent to compile on windows 95
# define _WIN32_WINDOWS 0x0410 # define _WIN32_WINDOWS 0x0410
# define WINVER 0x0400 # ifndef NL_COMP_MINGW
# define NOMINMAX # define WINVER 0x0400
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# include <direct.h> # include <direct.h>
#elif defined NL_OS_UNIX #elif defined NL_OS_UNIX

@ -22,7 +22,9 @@
#include "nel/misc/hierarchical_timer.h" #include "nel/misc/hierarchical_timer.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <winsock2.h> # include <winsock2.h>
# include <windows.h> # include <windows.h>
# define socklen_t int # define socklen_t int

@ -17,7 +17,9 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <winsock2.h> # include <winsock2.h>
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -21,7 +21,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# include <winsock2.h> # include <winsock2.h>
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# define socklen_t int # define socklen_t int
# define ERROR_NUM WSAGetLastError() # define ERROR_NUM WSAGetLastError()

@ -21,7 +21,9 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# include <winsock2.h> # include <winsock2.h>
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
# define socklen_t int # define socklen_t int
# define ERROR_NUM WSAGetLastError() # define ERROR_NUM WSAGetLastError()

@ -36,7 +36,7 @@ namespace NLNET {
static size_t ThreadCreator = 0; static size_t ThreadCreator = 0;
static const uint64 AppIdDeadConnection = 0xDEAD; static const uintptr_t AppIdDeadConnection = 0xDEAD;
uint32 TotalCallbackCalled = 0; uint32 TotalCallbackCalled = 0;

@ -1,4 +1,6 @@
EXPORTS NLSOUND_createISoundDriverInstance LIBRARY nel_drv_openal_win_r
EXPORTS NLSOUND_interfaceVersion EXPORTS
EXPORTS NLSOUND_outputProfile NLSOUND_createISoundDriverInstance
EXPORTS NLSOUND_getDriverType NLSOUND_interfaceVersion
NLSOUND_outputProfile
NLSOUND_getDriverType

@ -92,7 +92,12 @@ NLMISC_DECL_PURE_LIB(CSoundDriverALNelLibrary)
* Sound driver instance creation * Sound driver instance creation
*/ */
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#ifdef NL_COMP_MINGW
#ifndef NL_STATIC
extern "C"
{
#endif
#endif
// ****************************************************************** // ******************************************************************
#ifdef NL_STATIC #ifdef NL_STATIC
@ -140,7 +145,11 @@ __declspec(dllexport) ISoundDriver::TDriver NLSOUND_getDriverType()
} }
// ****************************************************************** // ******************************************************************
#ifdef NL_COMP_MINGW
#ifndef NL_STATIC
}
#endif
#endif
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
#ifndef NL_STATIC #ifndef NL_STATIC

@ -34,7 +34,9 @@
#endif // HAVE_CONFIG_H #endif // HAVE_CONFIG_H
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
@ -151,7 +153,9 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD
switch(driverType) switch(driverType)
{ {
case DriverFMod: case DriverFMod:
#if defined (NL_OS_WINDOWS) #if defined (NL_COMP_MINGW)
dllName = "libnel_drv_fmod_win";
#elif defined (NL_OS_WINDOWS)
dllName = "nel_drv_fmod_win"; dllName = "nel_drv_fmod_win";
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
dllName = "nel_drv_fmod"; dllName = "nel_drv_fmod";
@ -160,7 +164,9 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD
#endif // NL_OS_UNIX / NL_OS_WINDOWS #endif // NL_OS_UNIX / NL_OS_WINDOWS
break; break;
case DriverOpenAl: case DriverOpenAl:
#ifdef NL_OS_WINDOWS #if defined (NL_COMP_MINGW)
dllName = "libnel_drv_openal_win";
#elif defined (NL_OS_WINDOWS)
dllName = "nel_drv_openal_win"; dllName = "nel_drv_openal_win";
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
dllName = "nel_drv_openal"; dllName = "nel_drv_openal";
@ -169,7 +175,9 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD
#endif #endif
break; break;
case DriverDSound: case DriverDSound:
#ifdef NL_OS_WINDOWS #if defined (NL_COMP_MINGW)
dllName = "libnel_drv_dsound_win";
#elif defined (NL_OS_WINDOWS)
dllName = "nel_drv_dsound_win"; dllName = "nel_drv_dsound_win";
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
nlerror("DriverDSound doesn't exist on Unix because it requires DirectX"); nlerror("DriverDSound doesn't exist on Unix because it requires DirectX");
@ -178,7 +186,9 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD
#endif #endif
break; break;
case DriverXAudio2: case DriverXAudio2:
#ifdef NL_OS_WINDOWS #if defined (NL_COMP_MINGW)
dllName = "libnel_drv_xaudio2_win";
#elif defined (NL_OS_WINDOWS)
dllName = "nel_drv_xaudio2_win"; dllName = "nel_drv_xaudio2_win";
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
nlerror("DriverXAudio2 doesn't exist on Unix because it requires DirectX"); nlerror("DriverXAudio2 doesn't exist on Unix because it requires DirectX");
@ -187,7 +197,9 @@ ISoundDriver *ISoundDriver::createDriver(IStringMapperProvider *stringMapper, TD
#endif #endif
break; break;
default: default:
#ifdef NL_OS_WINDOWS #if defined (NL_COMP_MINGW)
dllName = "libnel_drv_xaudio2_win";
#elif defined (NL_OS_WINDOWS)
dllName = "nel_drv_xaudio2_win"; dllName = "nel_drv_xaudio2_win";
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
dllName = "nel_drv_openal"; dllName = "nel_drv_openal";

@ -62,7 +62,7 @@ protected:
/// Mutex for cross-thread access from XAudio2 callbacks. /// Mutex for cross-thread access from XAudio2 callbacks.
NLMISC::CMutex _Mutex; NLMISC::CMutex _Mutex;
/// Unique id for buffer. /// Unique id for buffer.
uint _LastBufferContext; uintptr_t _LastBufferContext;
/// Current buffer. /// Current buffer.
void *_ValidBufferContext[_BufferNb]; void *_ValidBufferContext[_BufferNb];
public: public:

@ -1,4 +1,6 @@
EXPORTS NLSOUND_createISoundDriverInstance LIBRARY nel_drv_xaudio2_win_r
EXPORTS NLSOUND_interfaceVersion EXPORTS
EXPORTS NLSOUND_outputProfile NLSOUND_createISoundDriverInstance
EXPORTS NLSOUND_getDriverType NLSOUND_interfaceVersion
NLSOUND_outputProfile
NLSOUND_getDriverType

@ -53,6 +53,14 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD /* ul_reason_for_call */, LPVOID /* lp
// *************************************************************************** // ***************************************************************************
#ifndef NL_STATIC
#ifdef NL_COMP_MINGW
extern "C" {
#endif
#endif
// ***************************************************************************
#ifdef NL_STATIC #ifdef NL_STATIC
ISoundDriver* createISoundDriverInstanceXAudio2 ISoundDriver* createISoundDriverInstanceXAudio2
#else #else
@ -99,6 +107,14 @@ __declspec(dllexport) ISoundDriver::TDriver NLSOUND_getDriverType()
// ****************************************************************** // ******************************************************************
#ifndef NL_STATIC
#ifdef NL_COMP_MINGW
}
#endif
#endif
// ******************************************************************
#ifdef NL_DEBUG #ifdef NL_DEBUG
static XAUDIO2_DEBUG_CONFIGURATION NLSOUND_XAUDIO2_DEBUG_CONFIGURATION_DISABLED = { static XAUDIO2_DEBUG_CONFIGURATION NLSOUND_XAUDIO2_DEBUG_CONFIGURATION_DISABLED = {

@ -25,9 +25,57 @@
#include <cfloat> #include <cfloat>
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
#include <intrin.h>
// 3rd Party Includes // 3rd Party Includes
#include <basetyps.h>
#define XAUDIO2_HELPER_FUNCTIONS #define XAUDIO2_HELPER_FUNCTIONS
#ifdef NL_COMP_MINGW
#define __in_bcount(x)
#define __in_bcount_opt(x)
#define __in_ecount(x)
#define __in_xcount(x)
#define __inout_bcount_full(x)
#define __inout_bcount_opt(x)
#define __out_bcount(x)
#define __out_bcount_full(x)
#define __out_bcount_opt(x)
#define __out_bcount_part_opt(x,y)
#define __out_ecount(x)
#define __out_xcount(x)
#define __deref_opt_inout_bcount_part_opt(x,y)
#define __deref_out_bcount(x)
#define __deref_out_bcount_opt(x)
#define __out
#define __in
#define __inout
#define __deref_out
#define __in_opt
#define __inout_opt
#define __out_opt
#define __deref
#define __deref_inout_opt
#define __reserved
#define __XMA2DEFS_INCLUDED__
#endif /* NL_COMP_MINGW */
#include <comdecl.h>
#ifdef NL_COMP_MINGW
#undef DEFINE_CLSID
#undef DEFINE_IID
#undef DECLSPEC_UUID_WRAPPER
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
class className; \
__CRT_UUID_DECL(className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) \
EXTERN_C const GUID CLSID_##className
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
interface interfaceName; \
__CRT_UUID_DECL(interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) \
EXTERN_C const GUID IID_##interfaceName
#endif /* NL_COMP_MINGW */
#include <xaudio2.h> #include <xaudio2.h>
#include <xaudio2fx.h> #include <xaudio2fx.h>
#include <x3daudio.h> #include <x3daudio.h>

@ -38,7 +38,9 @@
#include "nel/3d/event_mouse_listener.h" #include "nel/3d/event_mouse_listener.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -20,7 +20,9 @@
#include "shapes_exporter.h" #include "shapes_exporter.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS

@ -41,8 +41,10 @@
#include <nel/3d/height_map.h> #include <nel/3d/height_map.h>
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#define NOMINMAX # ifndef NL_COMP_MINGW
#include <windows.h> # define NOMINMAX
# endif
# include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
using namespace std; using namespace std;

@ -395,11 +395,11 @@ static void cbWSShardChooseShard (CMessage &msgin, const std::string &serviceNam
string addr; string addr;
msgin.serial (addr); msgin.serial (addr);
msgout.serial (addr); msgout.serial (addr);
ClientsServer->send (msgout, (TSockId)cookie.getUserAddr ()); ClientsServer->send (msgout, (TSockId)cookie.getUserAddr ()); // FIXME: 64-bit
return; return;
} }
msgout.serial(reason); msgout.serial(reason);
ClientsServer->send (msgout, (TSockId)cookie.getUserAddr ()); ClientsServer->send (msgout, (TSockId)cookie.getUserAddr ()); // FIXME: 64-bit
} }
static const TUnifiedCallbackItem WSCallbackArray[] = static const TUnifiedCallbackItem WSCallbackArray[] =

@ -117,7 +117,7 @@ static void cbWSShardChooseShard/* (CMessage &msgin, TSockId from, CCallbackNetB
*/ */
} }
WebServer->send (msgout, (TSockId)cookie.getUserAddr ()); WebServer->send (msgout, (TSockId)cookie.getUserAddr ()); // FIXME: 64-bit
} }
static const TUnifiedCallbackItem WSCallbackArray[] = static const TUnifiedCallbackItem WSCallbackArray[] =

@ -19,7 +19,9 @@
// we have to include windows.h because mysql.h uses it but not include it // we have to include windows.h because mysql.h uses it but not include it
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <winsock2.h> # include <winsock2.h>
# include <windows.h> # include <windows.h>
typedef unsigned long ulong; typedef unsigned long ulong;

@ -24,7 +24,9 @@
// we have to include windows.h because mysql.h uses it but not include it // we have to include windows.h because mysql.h uses it but not include it
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # ifndef NL_COMP_MINGW
# define NOMINMAX
# endif
# include <winsock2.h> # include <winsock2.h>
# include <windows.h> # include <windows.h>
typedef unsigned long ulong; typedef unsigned long ulong;

@ -229,7 +229,7 @@ void cbAddClient ( CMessage& msgin, TSockId from, CCallbackNetBase& clientcb )
if(from->appId() != 0) if(from->appId() != 0)
{ {
CPlayer *p = (CPlayer *)(uint)from->appId(); CPlayer *p = (CPlayer *)(void *)from->appId();
if(id == p->id) if(id == p->id)
p->State = CPlayer::ONLINE; p->State = CPlayer::ONLINE;
} }
@ -590,12 +590,12 @@ void onDisconnectClient ( TSockId from, void *arg )
{ {
uint32 id; uint32 id;
uint64 i = from->appId(); uintptr_t i = from->appId();
if(i == 0) if(i == 0)
return; return;
CPlayer *p = (CPlayer *)(uint)i; CPlayer *p = (CPlayer *)(void *)i;
id = p->id; id = p->id;
nlinfo( "A client with unique Id %u has disconnected", id ); nlinfo( "A client with unique Id %u has disconnected", id );

Loading…
Cancel
Save