From 5b69845c86cf18c0a6d32c68fbbc47a64f6c5e12 Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Thu, 21 Apr 2016 11:50:55 -0700
Subject: DRTVWR-418 remove references (and files) for QuickTime

---
 indra/cmake/CMakeLists.txt                         |    1 -
 indra/cmake/QuickTimePlugin.cmake                  |   48 -
 indra/media_plugins/CMakeLists.txt                 |    3 -
 indra/media_plugins/quicktime/CMakeLists.txt       |   90 --
 .../quicktime/media_plugin_quicktime.cpp           | 1084 --------------------
 5 files changed, 1226 deletions(-)
 delete mode 100755 indra/cmake/QuickTimePlugin.cmake
 delete mode 100755 indra/media_plugins/quicktime/CMakeLists.txt
 delete mode 100755 indra/media_plugins/quicktime/media_plugin_quicktime.cpp

(limited to 'indra')

diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index 04a2a16c27..a10a5a7895 100755
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -91,7 +91,6 @@ set(cmake_SOURCE_FILES
     Prebuilt.cmake
     PulseAudio.cmake
     Python.cmake
-    QuickTimePlugin.cmake
     TemplateCheck.cmake
     Tut.cmake
     UI.cmake
diff --git a/indra/cmake/QuickTimePlugin.cmake b/indra/cmake/QuickTimePlugin.cmake
deleted file mode 100755
index c08e153ee3..0000000000
--- a/indra/cmake/QuickTimePlugin.cmake
+++ /dev/null
@@ -1,48 +0,0 @@
-# -*- cmake -*-
-
-if(INSTALL_PROPRIETARY)
-  include(Prebuilt)
-  if (WINDOWS)
-    use_prebuilt_binary(quicktime)
-  endif (WINDOWS)
-endif(INSTALL_PROPRIETARY)
-
-if (DARWIN)
-  include(CMakeFindFrameworks)
-  find_library(QUICKTIME_LIBRARY QuickTime)
-elseif (WINDOWS)
-  set(QUICKTIME_SDK_DIR "$ENV{PROGRAMFILES}/QuickTime SDK"
-      CACHE PATH "Location of the QuickTime SDK.")
-
-  find_library(DEBUG_QUICKTIME_LIBRARY qtmlclient.lib
-               PATHS
-               ${ARCH_PREBUILT_DIRS_DEBUG}
-               "${QUICKTIME_SDK_DIR}\\libraries"
-               )
-
-  find_library(RELEASE_QUICKTIME_LIBRARY qtmlclient.lib
-               PATHS
-               ${ARCH_PREBUILT_DIRS_RELEASE}
-               "${QUICKTIME_SDK_DIR}\\libraries"
-               )
-
-  if (DEBUG_QUICKTIME_LIBRARY AND RELEASE_QUICKTIME_LIBRARY)
-    set(QUICKTIME_LIBRARY 
-        optimized ${RELEASE_QUICKTIME_LIBRARY}
-        debug ${DEBUG_QUICKTIME_LIBRARY}
-        )
-        
-  endif (DEBUG_QUICKTIME_LIBRARY AND RELEASE_QUICKTIME_LIBRARY)
-  
-  include_directories(
-    ${LIBS_PREBUILT_DIR}/include/quicktime
-    "${QUICKTIME_SDK_DIR}\\CIncludes"
-    )
-endif (DARWIN)
-
-mark_as_advanced(QUICKTIME_LIBRARY)
-
-if (QUICKTIME_LIBRARY)
-  set(QUICKTIME ON CACHE BOOL "Build with QuickTime streaming media support.")
-endif (QUICKTIME_LIBRARY)
-
diff --git a/indra/media_plugins/CMakeLists.txt b/indra/media_plugins/CMakeLists.txt
index 24eb3947b4..158e62b557 100755
--- a/indra/media_plugins/CMakeLists.txt
+++ b/indra/media_plugins/CMakeLists.txt
@@ -7,12 +7,9 @@ if (LINUX)
 endif (LINUX)
 
 if (WINDOWS OR DARWIN)
-    add_subdirectory(quicktime)
     add_subdirectory(cef)
 endif (WINDOWS OR DARWIN)
 
 if (WINDOWS)
     add_subdirectory(winmmshim)
 endif (WINDOWS)
-
-### add_subdirectory(example)
diff --git a/indra/media_plugins/quicktime/CMakeLists.txt b/indra/media_plugins/quicktime/CMakeLists.txt
deleted file mode 100755
index c5615145be..0000000000
--- a/indra/media_plugins/quicktime/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-# -*- cmake -*-
-
-project(media_plugin_quicktime)
-
-include(00-Common)
-include(LLCommon)
-include(LLImage)
-include(LLPlugin)
-include(LLMath)
-include(LLRender)
-include(LLWindow)
-include(Linking)
-include(PluginAPI)
-include(MediaPluginBase)
-include(OpenGL)
-include(QuickTimePlugin)
-include(Boost)
-
-include_directories(
-    ${LLPLUGIN_INCLUDE_DIRS}
-    ${MEDIA_PLUGIN_BASE_INCLUDE_DIRS}
-    ${LLCOMMON_INCLUDE_DIRS}
-    ${LLMATH_INCLUDE_DIRS}
-    ${LLIMAGE_INCLUDE_DIRS}
-    ${LLRENDER_INCLUDE_DIRS}
-    ${LLWINDOW_INCLUDE_DIRS}
-)
-include_directories(SYSTEM
-    ${LLCOMMON_SYSTEM_INCLUDE_DIRS}
-    )
-
-if (DARWIN)
-    include(CMakeFindFrameworks)
-    find_library(CARBON_LIBRARY Carbon)
-endif (DARWIN)
-
-
-### media_plugin_quicktime
-
-set(media_plugin_quicktime_SOURCE_FILES
-    media_plugin_quicktime.cpp
-    )
-
-add_library(media_plugin_quicktime
-    SHARED
-    ${media_plugin_quicktime_SOURCE_FILES}
-)
-
-target_link_libraries(media_plugin_quicktime
-  ${LLPLUGIN_LIBRARIES}
-  ${MEDIA_PLUGIN_BASE_LIBRARIES}
-  ${LLCOMMON_LIBRARIES}
-  ${QUICKTIME_LIBRARY}
-  ${PLUGIN_API_WINDOWS_LIBRARIES}
-)
-
-if (WINDOWS)
-  set_target_properties(
-    media_plugin_quicktime
-    PROPERTIES
-    LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO /NODEFAULTLIB:LIBCMT"
-    LINK_FLAGS_DEBUG "/MANIFEST:NO /SAFESEH:NO /NODEFAULTLIB:LIBCMTD"
-    )
-endif (WINDOWS)
-
-if (QUICKTIME)
-
-    add_definitions(-DLL_QUICKTIME_ENABLED=1)
-
-    if (DARWIN)
-      # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name
-      set_target_properties(
-        media_plugin_quicktime
-        PROPERTIES
-        PREFIX ""
-        BUILD_WITH_INSTALL_RPATH 1
-        INSTALL_NAME_DIR "@executable_path"
-        LINK_FLAGS "-exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/../base/media_plugin_base.exp"
-      )
-
-# We use a bunch of deprecated system APIs.
-    set_source_files_properties(
-        media_plugin_quicktime.cpp PROPERTIES
-        COMPILE_FLAGS -Wno-deprecated-declarations
-        )
-    find_library(CARBON_LIBRARY Carbon)
-    target_link_libraries(media_plugin_quicktime ${CARBON_LIBRARY})
-  endif (DARWIN)
-endif (QUICKTIME)
-
diff --git a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp
deleted file mode 100755
index 7ef5a0fe44..0000000000
--- a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp
+++ /dev/null
@@ -1,1084 +0,0 @@
-/**
- * @file media_plugin_quicktime.cpp
- * @brief QuickTime plugin for LLMedia API plugin system
- *
- * @cond
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- * @endcond
- */
-
-#include "linden_common.h"
-
-#include "llgl.h"
- 
-#include "llplugininstance.h"
-#include "llpluginmessage.h"
-#include "llpluginmessageclasses.h"
-#include "media_plugin_base.h"
- 
-#if LL_QUICKTIME_ENABLED
- 
-#if defined(LL_DARWIN)
-#include <QuickTime/QuickTime.h>
-#elif defined(LL_WINDOWS)
-#include "llwin32headers.h"
-#include "MacTypes.h"
-#include "QTML.h"
-#include "Movies.h"
-#include "QDoffscreen.h"
-#include "FixMath.h"
-#include "QTLoadLibraryUtils.h"
-#endif
-
-
-
-// TODO: Make sure that the only symbol exported from this library is LLPluginInitEntryPoint
-////////////////////////////////////////////////////////////////////////////////
-//
-class MediaPluginQuickTime : public MediaPluginBase
-{
-public:
-	MediaPluginQuickTime(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data);
-	~MediaPluginQuickTime();
-
-	/* virtual */ void receiveMessage(const char *message_string);
-
-private:
-
-	int mNaturalWidth;
-	int mNaturalHeight;
-	Movie mMovieHandle;
-	GWorldPtr mGWorldHandle;
-	ComponentInstance mMovieController;
-	int mCurVolume;
-	bool mMediaSizeChanging;
-	bool mIsLooping;
-	std::string mMovieTitle;
-	bool mReceivedTitle;
-	const int mMinWidth;
-	const int mMaxWidth;
-	const int mMinHeight;
-	const int mMaxHeight;
-	F64 mPlayRate;
-	std::string mNavigateURL;
-
-	enum ECommand {
-		COMMAND_NONE,
-		COMMAND_STOP,
-		COMMAND_PLAY,
-		COMMAND_FAST_FORWARD,
-		COMMAND_FAST_REWIND,
-		COMMAND_PAUSE,
-		COMMAND_SEEK,
-	};
-	ECommand mCommand;
-
-	// Override this to add current time and duration to the message
-	/*virtual*/ void setDirty(int left, int top, int right, int bottom)
-	{
-		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "updated");
-
-		message.setValueS32("left", left);
-		message.setValueS32("top", top);
-		message.setValueS32("right", right);
-		message.setValueS32("bottom", bottom);
-
-		if(mMovieHandle)
-		{
-			message.setValueReal("current_time", getCurrentTime());
-			message.setValueReal("duration", getDuration());
-			message.setValueReal("current_rate", Fix2X(GetMovieRate(mMovieHandle)));
-		}
-
-		sendMessage(message);
-	}
-
-
-	static Rect rectFromSize(int width, int height)
-	{
-		Rect result;
-
-
-		result.left = 0;
-		result.top = 0;
-		result.right = width;
-		result.bottom = height;
-
-		return result;
-	}
-
-	Fixed getPlayRate(void)
-	{
-		Fixed result;
-		if(mPlayRate == 0.0f)
-		{
-			// Default to the movie's preferred rate
-			result = GetMoviePreferredRate(mMovieHandle);
-			if(result == 0)
-			{
-				// Don't return a 0 play rate, ever.
-				std::cerr << "Movie's preferred rate is 0, forcing to 1.0." << std::endl;
-				result = X2Fix(1.0f);
-			}
-		}
-		else
-		{
-			result = X2Fix(mPlayRate);
-		}
-
-		return result;
-	}
-
-	void load( const std::string url )
-	{
-
-		if ( url.empty() )
-			return;
-
-		// Stop and unload any existing movie before starting another one.
-		unload();
-
-		setStatus(STATUS_LOADING);
-
-		//In case std::string::c_str() makes a copy of the url data,
-		//make sure there is memory to hold it before allocating memory for handle.
-		//if fails, NewHandleClear(...) should return NULL.
-		const char* url_string = url.c_str() ;
-		Handle handle = NewHandleClear( ( Size )( url.length() + 1 ) );
-
-		if ( NULL == handle || noErr != MemError() || NULL == *handle )
-		{
-			setStatus(STATUS_ERROR);
-			return;
-		}
-
-		BlockMove( url_string, *handle, ( Size )( url.length() + 1 ) );
-
-		OSErr err = NewMovieFromDataRef( &mMovieHandle, newMovieActive | newMovieDontInteractWithUser | newMovieAsyncOK | newMovieIdleImportOK, nil, handle, URLDataHandlerSubType );
-		DisposeHandle( handle );
-		if ( noErr != err )
-		{
-			setStatus(STATUS_ERROR);
-			return;
-		};
-		
-		mNavigateURL = url;
-		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_begin");
-		message.setValue("uri", mNavigateURL);
-		sendMessage(message);
-
-		// do pre-roll actions (typically fired for streaming movies but not always)
-		PrePrerollMovie( mMovieHandle, 0, getPlayRate(), moviePrePrerollCompleteCallback, ( void * )this );
-
-		Rect movie_rect = rectFromSize(mWidth, mHeight);
-
-		// make a new movie controller
-		mMovieController = NewMovieController( mMovieHandle, &movie_rect, mcNotVisible | mcTopLeftMovie );
-
-		// movie controller
-		MCSetActionFilterWithRefCon( mMovieController, mcActionFilterCallBack, ( long )this );
-
-		SetMoviePlayHints( mMovieHandle, hintsAllowDynamicResize, hintsAllowDynamicResize );
-
-		// function that gets called when a frame is drawn
-		SetMovieDrawingCompleteProc( mMovieHandle, movieDrawingCallWhenChanged, movieDrawingCompleteCallback, ( long )this );
-
-		setStatus(STATUS_LOADED);
-
-		sizeChanged();
-	};
-
-	bool unload()
-	{
-		// new movie and have to get title again
-		mReceivedTitle = false;
-
-		if ( mMovieHandle )
-		{
-			StopMovie( mMovieHandle );
-			if ( mMovieController )
-			{
-				MCMovieChanged( mMovieController, mMovieHandle );
-			};
-		};
-
-		if ( mMovieController )
-		{
-			MCSetActionFilterWithRefCon( mMovieController, NULL, (long)this );
-			DisposeMovieController( mMovieController );
-			mMovieController = NULL;
-		};
-
-		if ( mMovieHandle )
-		{
-			SetMovieDrawingCompleteProc( mMovieHandle, movieDrawingCallWhenChanged, nil, ( long )this );
-			DisposeMovie( mMovieHandle );
-			mMovieHandle = NULL;
-		};
-
-        mGWorldHandle = NULL;
-        
-		setStatus(STATUS_NONE);
-
-		return true;
-	}
-
-	bool navigateTo( const std::string url )
-	{
-		unload();
-		load( url );
-
-		return true;
-	};
-
-	bool sizeChanged()
-	{
-		if ( ! mMovieHandle )
-			return false;
-
-		// Check to see whether the movie's natural size has updated
-		{
-			int width, height;
-			getMovieNaturalSize(&width, &height);
-			if((width != 0) && (height != 0) && ((width != mNaturalWidth) || (height != mNaturalHeight)))
-			{
-				mNaturalWidth = width;
-				mNaturalHeight = height;
-
-				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_request");
-				message.setValue("name", mTextureSegmentName);
-				message.setValueS32("width", width);
-				message.setValueS32("height", height);
-				sendMessage(message);
-				//std::cerr << "<--- Sending size change request to application with name: " << mTextureSegmentName << " - size is " << width << " x " << height << std::endl;
-			}
-		}
-        
-
-		// sanitize destination size
-		Rect dest_rect = rectFromSize(mWidth, mHeight);
-
-		// media depth won't change
-		int depth_bits = mDepth * 8;
-		long rowbytes = mDepth * mTextureWidth;
-
-		if(mPixels != NULL)
-		{
-			// We have pixels.  Set up a GWorld pointing at the texture.
-			OSErr result = QTNewGWorldFromPtr( &mGWorldHandle, depth_bits, &dest_rect, NULL, NULL, 0, (Ptr)mPixels, rowbytes);
-			if ( noErr != result )
-			{
-				// TODO: unrecoverable??  throw exception?  return something?
-				return false;
-			}
-		}
-		else
-		{
-			// We don't have pixels. Create a fake GWorld we can point the movie at when it's not safe to render normally.
-			Rect tempRect = rectFromSize(1, 1);
-			OSErr result = QTNewGWorld( &mGWorldHandle, depth_bits, &tempRect, NULL, NULL, 0);
-			if ( noErr != result )
-			{
-				// TODO: unrecoverable??  throw exception?  return something?
-				return false;
-			}
-		}
-
-		SetMovieGWorld( mMovieHandle, mGWorldHandle, NULL );
-        
-		// Set up the movie display matrix
-		{
-			// scale movie to fit rect and invert vertically to match opengl image format
-			MatrixRecord transform;
-			SetIdentityMatrix( &transform );	// transforms are additive so start from identify matrix
-			double scaleX = (double) mWidth / mNaturalWidth;
-			double scaleY = -1.0 * (double) mHeight / mNaturalHeight;
-			double centerX = mWidth / 2.0;
-			double centerY = mHeight / 2.0;
-			ScaleMatrix( &transform, X2Fix( scaleX ), X2Fix( scaleY ), X2Fix( centerX ), X2Fix( centerY ) );
-			SetMovieMatrix( mMovieHandle, &transform );
-		}
-
-		// update movie controller
-		if ( mMovieController )
-		{
-			MCSetControllerPort( mMovieController, mGWorldHandle );
-			MCPositionController( mMovieController, &dest_rect, &dest_rect,
-								  mcTopLeftMovie | mcPositionDontInvalidate );
-			MCMovieChanged( mMovieController, mMovieHandle );
-		}
-
-
-		// Emit event with size change so the calling app knows about it too
-		// TODO:
-		//LLMediaEvent event( this );
-		//mEventEmitter.update( &LLMediaObserver::onMediaSizeChange, event );
-
-		return true;
-	}
-	static Boolean mcActionFilterCallBack( MovieController mc, short action, void *params, long ref )
-	{
-		Boolean result = false;
-
-		MediaPluginQuickTime* self = ( MediaPluginQuickTime* )ref;
-
-		switch( action )
-		{
-			// handle window resizing
-			case mcActionControllerSizeChanged:
-				// Ensure that the movie draws correctly at the new size
-				self->sizeChanged();
-				break;
-
-			// Block any movie controller actions that open URLs.
-			case mcActionLinkToURL:
-			case mcActionGetNextURL:
-			case mcActionLinkToURLExtended:
-				// Prevent the movie controller from handling the message
-				result = true;
-				break;
-
-			default:
-				break;
-		};
-
-		return result;
-	};
-
-	static OSErr movieDrawingCompleteCallback( Movie call_back_movie, long ref )
-	{
-		MediaPluginQuickTime* self = ( MediaPluginQuickTime* )ref;
-
-		// IMPORTANT: typically, a consumer who is observing this event will set a flag
-		// when this event is fired then render later. Be aware that the media stream
-		// can change during this period - dimensions, depth, format etc.
-		//LLMediaEvent event( self );
-//		self->updateQuickTime();
-		// TODO ^^^
-
-
-		if ( self->mWidth > 0 && self->mHeight > 0 )
-			self->setDirty( 0, 0, self->mWidth, self->mHeight );
-
-		return noErr;
-	};
-
-	static void moviePrePrerollCompleteCallback( Movie movie, OSErr preroll_err, void *ref )
-	{
-		MediaPluginQuickTime* self = ( MediaPluginQuickTime* )ref;
-
-		// TODO:
-		//LLMediaEvent event( self );
-		//self->mEventEmitter.update( &LLMediaObserver::onMediaPreroll, event );
-		
-		// Send a "navigate complete" event.
-		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_complete");
-		message.setValue("uri", self->mNavigateURL);
-		message.setValueS32("result_code", 200);
-		message.setValue("result_string", "OK");
-		self->sendMessage(message);
-	};
-
-
-	void rewind()
-	{
-		GoToBeginningOfMovie( mMovieHandle );
-		MCMovieChanged( mMovieController, mMovieHandle );
-	};
-
-	bool processState()
-	{
-		if ( mCommand == COMMAND_PLAY )
-		{
-			if ( mStatus == STATUS_LOADED || mStatus == STATUS_PAUSED || mStatus == STATUS_PLAYING || mStatus == STATUS_DONE )
-			{
-				long state = GetMovieLoadState( mMovieHandle );
-
-				if ( state >= kMovieLoadStatePlaythroughOK )
-				{
-					// if the movie is at the end (generally because it reached it naturally)
-					// and we play is requested, jump back to the start of the movie.
-					// note: this is different from having loop flag set.
-					if ( IsMovieDone( mMovieHandle ) )
-					{
-						Fixed rate = X2Fix( 0.0 );
-						MCDoAction( mMovieController, mcActionPlay, (void*)rate );
-						rewind();
-					};
-
-					MCDoAction( mMovieController, mcActionPrerollAndPlay, (void*)getPlayRate() );
-					MCDoAction( mMovieController, mcActionSetVolume, (void*)mCurVolume );
-					setStatus(STATUS_PLAYING);
-					mCommand = COMMAND_NONE;
-				};
-			};
-		}
-		else
-		if ( mCommand == COMMAND_STOP )
-		{
-			if ( mStatus == STATUS_PLAYING || mStatus == STATUS_PAUSED || mStatus == STATUS_DONE )
-			{
-				if ( GetMovieLoadState( mMovieHandle ) >= kMovieLoadStatePlaythroughOK )
-				{
-					Fixed rate = X2Fix( 0.0 );
-					MCDoAction( mMovieController, mcActionPlay, (void*)rate );
-					rewind();
-
-					setStatus(STATUS_LOADED);
-					mCommand = COMMAND_NONE;
-				};
-			};
-		}
-		else
-		if ( mCommand == COMMAND_PAUSE )
-		{
-			if ( mStatus == STATUS_PLAYING )
-			{
-				if ( GetMovieLoadState( mMovieHandle ) >= kMovieLoadStatePlaythroughOK )
-				{
-					Fixed rate = X2Fix( 0.0 );
-					MCDoAction( mMovieController, mcActionPlay, (void*)rate );
-					setStatus(STATUS_PAUSED);
-					mCommand = COMMAND_NONE;
-				};
-			};
-		};
-
-		return true;
-	};
-
-	void play(F64 rate)
-	{
-		mPlayRate = rate;
-		mCommand = COMMAND_PLAY;
-	};
-
-	void stop()
-	{
-		mCommand = COMMAND_STOP;
-	};
-
-	void pause()
-	{
-		mCommand = COMMAND_PAUSE;
-	};
-
-	void getMovieNaturalSize(int *movie_width, int *movie_height)
-	{
-		Rect rect;
-
-		GetMovieNaturalBoundsRect( mMovieHandle, &rect );
-
-		int width  = ( rect.right - rect.left );
-		int height = ( rect.bottom - rect.top );
-
-		// make sure width and height fall in valid range
-		if ( width < mMinWidth )
-			width = mMinWidth;
-
-		if ( width > mMaxWidth )
-			width = mMaxWidth;
-
-		if ( height < mMinHeight )
-			height = mMinHeight;
-
-		if ( height > mMaxHeight )
-			height = mMaxHeight;
-
-		// return the new rect
-		*movie_width = width;
-		*movie_height = height;
-	}
-
-	void updateQuickTime(int milliseconds)
-	{
-		if ( ! mMovieHandle )
-			return;
-
-		if ( ! mMovieController )
-			return;
-
-		// this wasn't required in 1.xx viewer but we have to manually 
-		// work the Windows message pump now
-		#if defined( LL_WINDOWS )
-		MSG msg;
-		while ( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) 
-		{
-			GetMessage( &msg, NULL, 0, 0 );
-			TranslateMessage( &msg );
-			DispatchMessage( &msg );
-		};
-		#endif
-
-		MCIdle( mMovieController );
-
-		if ( ! mGWorldHandle )
-			return;
-
-		if ( mMediaSizeChanging )
-			return;
-
-		// update state machine
-		processState();
-
-		// see if title arrived and if so, update member variable with contents
-		checkTitle();
-		
-		// QT call to see if we are at the end - can't do with controller
-		if ( IsMovieDone( mMovieHandle ) )
-		{
-			// special code for looping - need to rewind at the end of the movie
-			if ( mIsLooping )
-			{
-				// go back to start
-				rewind();
-
-				if ( mMovieController )
-				{
-					// kick off new play
-					MCDoAction( mMovieController, mcActionPrerollAndPlay, (void*)getPlayRate() );
-
-					// set the volume
-					MCDoAction( mMovieController, mcActionSetVolume, (void*)mCurVolume );
-				};
-			}
-			else
-			{
-				if(mStatus == STATUS_PLAYING)
-				{
-					setStatus(STATUS_DONE);
-				}
-			}
-		}
-
-	};
-    
-	void seek( F64 time )
-	{
-		if ( mMovieController )
-		{
-			TimeRecord when;
-			when.scale = GetMovieTimeScale( mMovieHandle );
-			when.base = 0;
-
-			// 'time' is in (floating point) seconds.  The timebase time will be in 'units', where
-			// there are 'scale' units per second.
-			SInt64 raw_time = ( SInt64 )( time * (double)( when.scale ) );
-
-			when.value.hi = ( SInt32 )( raw_time >> 32 );
-			when.value.lo = ( SInt32 )( ( raw_time & 0x00000000FFFFFFFF ) );
-
-			MCDoAction( mMovieController, mcActionGoToTime, &when );
-		};
-	};
-
-	F64 getLoadedDuration() 	  	 
-	{ 	  	 
-		TimeValue duration; 	  	 
-		if(GetMaxLoadedTimeInMovie( mMovieHandle, &duration ) != noErr) 	  	 
-		{ 	  	 
-			// If GetMaxLoadedTimeInMovie returns an error, return the full duration of the movie. 	  	 
-			duration = GetMovieDuration( mMovieHandle ); 	  	 
-		} 	  	 
-		TimeValue scale = GetMovieTimeScale( mMovieHandle ); 	  	 
-
-		return (F64)duration / (F64)scale; 	  	 
-	}; 	  	 
-
-	F64 getDuration()
-	{
-		TimeValue duration = GetMovieDuration( mMovieHandle );
-		TimeValue scale = GetMovieTimeScale( mMovieHandle );
-
-		return (F64)duration / (F64)scale;
-	};
-
-	F64 getCurrentTime()
-	{
-		TimeValue curr_time = GetMovieTime( mMovieHandle, 0 );
-		TimeValue scale = GetMovieTimeScale( mMovieHandle );
-
-		return (F64)curr_time / (F64)scale;
-	};
-
-	void setVolume( F64 volume )
-	{
-		mCurVolume = (short)(volume * ( double ) 0x100 );
-
-		if ( mMovieController )
-		{
-			MCDoAction( mMovieController, mcActionSetVolume, (void*)mCurVolume );
-		};
-	};
-
-	////////////////////////////////////////////////////////////////////////////////
-	//
-	void update(int milliseconds = 0)
-	{
-		updateQuickTime(milliseconds);
-	};
-
-	////////////////////////////////////////////////////////////////////////////////
-	//
-	void mouseDown( int x, int y )
-	{
-	};
-
-	////////////////////////////////////////////////////////////////////////////////
-	//
-	void mouseUp( int x, int y )
-	{
-	};
-
-	////////////////////////////////////////////////////////////////////////////////
-	//
-	void mouseMove( int x, int y )
-	{
-	};
-
-	////////////////////////////////////////////////////////////////////////////////
-	//
-	void keyPress( unsigned char key )
-	{
-	};
-
-	////////////////////////////////////////////////////////////////////////////////
-	// Grab movie title into mMovieTitle - should be called repeatedly
-	// until it returns true since movie title takes a while to become 
-	// available.
-	const bool getMovieTitle()
-	{
-		// grab meta data from movie
-		QTMetaDataRef media_data_ref;
-		OSErr result = QTCopyMovieMetaData( mMovieHandle, &media_data_ref );
-		if ( noErr != result ) 
-			return false;
-
-		// look up "Display Name" in meta data
-		OSType meta_data_key = kQTMetaDataCommonKeyDisplayName;
-		QTMetaDataItem item = kQTMetaDataItemUninitialized;
-		result = (OSErr)QTMetaDataGetNextItem( media_data_ref, kQTMetaDataStorageFormatWildcard, 
-										0, kQTMetaDataKeyFormatCommon, 
-										(const UInt8 *)&meta_data_key, 
-										sizeof( meta_data_key ), &item );
-		if ( noErr != result ) 
-			return false;
-
-		// find the size of the title
-		ByteCount size;
-		result = (OSErr)QTMetaDataGetItemValue( media_data_ref, item, NULL, 0, &size );
-		if ( noErr != result || size <= 0 /*|| size > 1024  FIXME: arbitrary limit */ ) 
-			return false;
-
-		// allocate some space and grab it
-		UInt8* item_data = new UInt8[ size + 1 ];
-		memset( item_data, 0, ( size + 1 ) * sizeof( UInt8 ) );
-		result = (OSErr)QTMetaDataGetItemValue( media_data_ref, item, item_data, size, NULL );
-		if ( noErr != result ) 
-		{
-			delete [] item_data;
-			return false;
-		};
-
-		// save it
-		if ( strlen( (char*)item_data ) )
-			mMovieTitle = std::string( (char* )item_data );
-		else
-			mMovieTitle = "";
-
-		// clean up
-		delete [] item_data;
-
-		return true;
-	};
-
-	// called regularly to see if title changed
-	void checkTitle()
-	{
-		// we did already receive title so keep checking
-		if ( ! mReceivedTitle )
-		{
-			// grab title from movie meta data
-			if ( getMovieTitle() )
-			{
-				// pass back to host application
-				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "name_text");
-				message.setValue("name", mMovieTitle );
-				sendMessage( message );
-
-				// stop looking once we find a title for this movie.
-				// TODO: this may to be reset if movie title changes
-				// during playback but this is okay for now
-				mReceivedTitle = true;
-			};
-		};
-	};
-};
-
-MediaPluginQuickTime::MediaPluginQuickTime(
-	LLPluginInstance::sendMessageFunction host_send_func,
-	void *host_user_data ) :
-	MediaPluginBase(host_send_func, host_user_data),
-	mMinWidth( 0 ),
-	mMaxWidth( 2048 ),
-	mMinHeight( 0 ),
-	mMaxHeight( 2048 )
-{
-//	std::cerr << "MediaPluginQuickTime constructor" << std::endl;
-
-	mNaturalWidth = -1;
-	mNaturalHeight = -1;
-	mMovieHandle = 0;
-	mGWorldHandle = 0;
-	mMovieController = 0;
-	mCurVolume = 0x99;
-	mMediaSizeChanging = false;
-	mIsLooping = false;
-	mMovieTitle = std::string();
-	mReceivedTitle = false;
-	mCommand = COMMAND_NONE;
-	mPlayRate = 0.0f;
-	mStatus = STATUS_NONE;
-}
-
-MediaPluginQuickTime::~MediaPluginQuickTime()
-{
-//	std::cerr << "MediaPluginQuickTime destructor" << std::endl;
-
-	ExitMovies();
-
-#ifdef LL_WINDOWS
-	TerminateQTML();
-//		std::cerr << "QuickTime closing down" << std::endl;
-#endif
-}
-
-
-void MediaPluginQuickTime::receiveMessage(const char *message_string)
-{
-//	std::cerr << "MediaPluginQuickTime::receiveMessage: received message: \"" << message_string << "\"" << std::endl;
-	LLPluginMessage message_in;
-
-	if(message_in.parse(message_string) >= 0)
-	{
-		std::string message_class = message_in.getClass();
-		std::string message_name = message_in.getName();
-		if(message_class == LLPLUGIN_MESSAGE_CLASS_BASE)
-		{
-			if(message_name == "init")
-			{
-				LLPluginMessage message("base", "init_response");
-				LLSD versions = LLSD::emptyMap();
-				versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION;
-				versions[LLPLUGIN_MESSAGE_CLASS_MEDIA] = LLPLUGIN_MESSAGE_CLASS_MEDIA_VERSION;
-				// Normally a plugin would only specify one of these two subclasses, but this is a demo...
-				versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME] = LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME_VERSION;
-				message.setValueLLSD("versions", versions);
-
-				#ifdef LL_WINDOWS
-
-				// QuickTime 7.6.4 has an issue (that was not present in 7.6.2) with initializing QuickTime
-				// according to this article: http://lists.apple.com/archives/QuickTime-API/2009/Sep/msg00097.html
-				// The solution presented there appears to work.
-				QTLoadLibrary("qtcf.dll");
-
-				// main initialization for QuickTime - only required on Windows
-				OSErr result = InitializeQTML( 0L );
-				if ( result != noErr )
-				{
-					//TODO: If no QT on Windows, this fails - respond accordingly.
-				}
-				else
-				{
-					//std::cerr << "QuickTime initialized" << std::endl;
-				};
-				#endif
-
-				// required for both Windows and Mac
-				EnterMovies();
-
-				std::string plugin_version = "QuickTime media plugin, QuickTime version ";
-
-				long version = 0;
-				Gestalt( gestaltQuickTimeVersion, &version );
-				std::ostringstream codec( "" );
-				codec << std::hex << version << std::dec;
-				plugin_version += codec.str();
-				message.setValue("plugin_version", plugin_version);
-				sendMessage(message);
-			}
-			else if(message_name == "idle")
-			{
-				// no response is necessary here.
-				F64 time = message_in.getValueReal("time");
-
-				// Convert time to milliseconds for update()
-				update((int)(time * 1000.0f));
-			}
-			else if(message_name == "cleanup")
-			{
-				// TODO: clean up here
-                LLPluginMessage message("base", "goodbye");
-                sendMessage(message);
-            }
-			else if(message_name == "shm_added")
-			{
-				SharedSegmentInfo info;
-				info.mAddress = message_in.getValuePointer("address");
-				info.mSize = (size_t)message_in.getValueS32("size");
-				std::string name = message_in.getValue("name");
-//				std::cerr << "MediaPluginQuickTime::receiveMessage: shared memory added, name: " << name
-//					<< ", size: " << info.mSize
-//					<< ", address: " << info.mAddress
-//					<< std::endl;
-
-				mSharedSegments.insert(SharedSegmentMap::value_type(name, info));
-
-			}
-			else if(message_name == "shm_remove")
-			{
-				std::string name = message_in.getValue("name");
-
-//				std::cerr << "MediaPluginQuickTime::receiveMessage: shared memory remove, name = " << name << std::endl;
-
-				SharedSegmentMap::iterator iter = mSharedSegments.find(name);
-				if(iter != mSharedSegments.end())
-				{
-					if(mPixels == iter->second.mAddress)
-					{
-						// This is the currently active pixel buffer.  Make sure we stop drawing to it.
-						mPixels = NULL;
-						mTextureSegmentName.clear();
-
-						// Make sure the movie GWorld is no longer pointed at the shared segment.
-						sizeChanged();
-					}
-					mSharedSegments.erase(iter);
-				}
-				else
-				{
-//					std::cerr << "MediaPluginQuickTime::receiveMessage: unknown shared memory region!" << std::endl;
-				}
-
-				// Send the response so it can be cleaned up.
-				LLPluginMessage message("base", "shm_remove_response");
-				message.setValue("name", name);
-				sendMessage(message);
-			}
-			else
-			{
-//				std::cerr << "MediaPluginQuickTime::receiveMessage: unknown base message: " << message_name << std::endl;
-			}
-		}
-		else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA)
-		{
-			if(message_name == "init")
-			{
-				// This is the media init message -- all necessary data for initialization should have been received.
-
-				// Plugin gets to decide the texture parameters to use.
-				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "texture_params");
-				#if defined(LL_WINDOWS)
-					// Values for Windows
-					mDepth = 3;
-					message.setValueU32("format", GL_RGB);
-					message.setValueU32("type", GL_UNSIGNED_BYTE);
-
-					// We really want to pad the texture width to a multiple of 32 bytes, but since we're using 3-byte pixels, it doesn't come out even.
-					// Padding to a multiple of 3*32 guarantees it'll divide out properly.
-					message.setValueU32("padding", 32 * 3);
-				#else
-					// Values for Mac
-					mDepth = 4;
-					message.setValueU32("format", GL_BGRA_EXT);
-					#ifdef __BIG_ENDIAN__
-						message.setValueU32("type", GL_UNSIGNED_INT_8_8_8_8_REV );
-					#else
-						message.setValueU32("type", GL_UNSIGNED_INT_8_8_8_8);
-					#endif
-
-					// Pad texture width to a multiple of 32 bytes, to line up with cache lines.
-					message.setValueU32("padding", 32);
-				#endif
-				message.setValueS32("depth", mDepth);
-				message.setValueU32("internalformat", GL_RGB);
-				message.setValueBoolean("coords_opengl", true);	// true == use OpenGL-style coordinates, false == (0,0) is upper left.
-				message.setValueBoolean("allow_downsample", true);
-				sendMessage(message);
-			}
-			else if(message_name == "size_change")
-			{
-				std::string name = message_in.getValue("name");
-				S32 width = message_in.getValueS32("width");
-				S32 height = message_in.getValueS32("height");
-				S32 texture_width = message_in.getValueS32("texture_width");
-				S32 texture_height = message_in.getValueS32("texture_height");
-
-				//std::cerr << "---->Got size change instruction from application with name: " << name << " - size is " << width << " x " << height << std::endl;
-
-				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response");
-				message.setValue("name", name);
-				message.setValueS32("width", width);
-				message.setValueS32("height", height);
-				message.setValueS32("texture_width", texture_width);
-				message.setValueS32("texture_height", texture_height);
-				sendMessage(message);
-
-				if(!name.empty())
-				{
-					// Find the shared memory region with this name
-					SharedSegmentMap::iterator iter = mSharedSegments.find(name);
-					if(iter != mSharedSegments.end())
-					{
-//						std::cerr << "%%% Got size change, new size is " << width << " by " << height << std::endl;
-//						std::cerr << "%%%%  texture size is " << texture_width << " by " << texture_height << std::endl;
-
-						mPixels = (unsigned char*)iter->second.mAddress;
-						mTextureSegmentName = name;
-						mWidth = width;
-						mHeight = height;
-
-						mTextureWidth = texture_width;
-						mTextureHeight = texture_height;
-
-						mMediaSizeChanging = false;
-
-						sizeChanged();
-
-						update();
-					};
-				};
-			}
-			else if(message_name == "load_uri")
-			{
-				std::string uri = message_in.getValue("uri");
-				load( uri );
-				sendStatus();
-			}
-			else if(message_name == "mouse_event")
-			{
-				std::string event = message_in.getValue("event");
-				S32 x = message_in.getValueS32("x");
-				S32 y = message_in.getValueS32("y");
-
-				if(event == "down")
-				{
-					mouseDown(x, y);
-				}
-				else if(event == "up")
-				{
-					mouseUp(x, y);
-				}
-				else if(event == "move")
-				{
-					mouseMove(x, y);
-				};
-			};
-		}
-		else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME)
-		{
-			if(message_name == "stop")
-			{
-				stop();
-			}
-			else if(message_name == "start")
-			{
-				F64 rate = 0.0;
-				if(message_in.hasValue("rate"))
-				{
-					rate = message_in.getValueReal("rate");
-				}
-				play(rate);
-			}
-			else if(message_name == "pause")
-			{
-				pause();
-			}
-			else if(message_name == "seek")
-			{
-				F64 time = message_in.getValueReal("time");
-				seek(time);
-			}
-			else if(message_name == "set_loop")
-			{
-				bool loop = message_in.getValueBoolean("loop");
-				mIsLooping = loop;
-			}
-			else if(message_name == "set_volume")
-			{
-				F64 volume = message_in.getValueReal("volume");
-				setVolume(volume);
-			}
-		}
-		else
-		{
-//			std::cerr << "MediaPluginQuickTime::receiveMessage: unknown message class: " << message_class << std::endl;
-		};
-	};
-}
-
-int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data)
-{
-	MediaPluginQuickTime *self = new MediaPluginQuickTime(host_send_func, host_user_data);
-	*plugin_send_func = MediaPluginQuickTime::staticReceiveMessage;
-	*plugin_user_data = (void*)self;
-
-	return 0;
-}
-
-#else // LL_QUICKTIME_ENABLED
-
-// Stubbed-out class with constructor/destructor (necessary or windows linker
-// will just think its dead code and optimize it all out)
-class MediaPluginQuickTime : public MediaPluginBase
-{
-public:
-	MediaPluginQuickTime(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data);
-	~MediaPluginQuickTime();
-	/* virtual */ void receiveMessage(const char *message_string);
-};
-
-MediaPluginQuickTime::MediaPluginQuickTime(
-	LLPluginInstance::sendMessageFunction host_send_func,
-	void *host_user_data ) :
-	MediaPluginBase(host_send_func, host_user_data)
-{
-    // no-op
-}
-
-MediaPluginQuickTime::~MediaPluginQuickTime()
-{
-    // no-op
-}
-
-void MediaPluginQuickTime::receiveMessage(const char *message_string)
-{
-    // no-op
-}
-
-// We're building without quicktime enabled.  Just refuse to initialize.
-int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data)
-{
-    return -1;
-}
-
-#endif // LL_QUICKTIME_ENABLED
-- 
cgit v1.2.3


From c6725ef975941b816cba5903820ae754e6c8d9a8 Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Thu, 21 Apr 2016 11:54:13 -0700
Subject: DRTVWR-418 remove references to unused TestApps folder (used to
 contain media_plugin_test)

---
 indra/test_apps/llplugintest/CMakeLists.txt | 336 ----------------------------
 indra/test_apps/llplugintest/README.Linden  |  21 --
 indra/test_apps/llplugintest/bookmarks.txt  |  37 ---
 3 files changed, 394 deletions(-)
 delete mode 100755 indra/test_apps/llplugintest/CMakeLists.txt
 delete mode 100644 indra/test_apps/llplugintest/README.Linden
 delete mode 100755 indra/test_apps/llplugintest/bookmarks.txt

(limited to 'indra')

diff --git a/indra/test_apps/llplugintest/CMakeLists.txt b/indra/test_apps/llplugintest/CMakeLists.txt
deleted file mode 100755
index e682eaccca..0000000000
--- a/indra/test_apps/llplugintest/CMakeLists.txt
+++ /dev/null
@@ -1,336 +0,0 @@
-# -*- cmake -*-
-project(llplugintest)
-
-include(00-Common)
-include(OpenGL)
-include(LLCommon)
-include(LLPlugin)
-include(Linking)
-include(LLSharedLibs)
-include(PluginAPI)
-include(LLImage)
-include(LLMath)
-include(LLMessage)
-include(LLRender)
-include(LLWindow)
-include(Glut)
-include(Glui)
-
-include_directories(
-    ${LLPLUGIN_INCLUDE_DIRS}
-    ${LLCOMMON_INCLUDE_DIRS}
-    ${LLIMAGE_INCLUDE_DIRS}
-    ${LLMATH_INCLUDE_DIRS}
-    ${LLMESSAGE_INCLUDE_DIRS}
-    ${LLRENDER_INCLUDE_DIRS}
-    ${LLWINDOW_INCLUDE_DIRS}
-)
-include_directories(SYSTEM
-    ${LLCOMMON_SYSTEM_INCLUDE_DIRS}
-    )
-
-if (DARWIN)
-    include(CMakeFindFrameworks)
-    find_library(COREFOUNDATION_LIBRARY CoreFoundation)
-endif (DARWIN)
-
-### demo_plugin
-
-#set(demo_plugin_SOURCE_FILES
-#    demo_plugin.cpp
-#    )
-#
-#add_library(demo_plugin
-#    SHARED
-#    ${demo_plugin_SOURCE_FILES}
-#)
-#
-#target_link_libraries(demo_plugin
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#  ${PLUGIN_API_WINDOWS_LIBRARIES}
-#)
-#
-#add_dependencies(demo_plugin
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#)
-#
-#if (DARWIN)
-#  # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name
-#  set_target_properties(
-#    demo_plugin
-#    PROPERTIES
-#    PREFIX ""
-#    BUILD_WITH_INSTALL_RPATH 1
-#    INSTALL_NAME_DIR "@executable_path"
-#  )
-#endif (DARWIN)
-
-### plugin_host
-
-#set(plugin_host_SOURCE_FILES
-#    plugin_host.cpp
-#    )
-#
-#add_executable(plugin_host
-#    WIN32
-#    ${plugin_host_SOURCE_FILES}
-#)
-#
-#set_target_properties(plugin_host
-#    PROPERTIES
-#    WIN32_EXECUTABLE
-#    FALSE
-#)
-#
-#target_link_libraries(plugin_host
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#  ${PLUGIN_API_WINDOWS_LIBRARIES}
-#)
-#
-#add_dependencies(plugin_host
-#  demo_plugin
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#)
-
-### plugin_process_launcher
-
-#set(plugin_process_launcher_SOURCE_FILES
-#    plugin_process_launcher.cpp
-#    )
-#
-#add_executable(plugin_process_launcher
-#    WIN32
-#    ${plugin_process_launcher_SOURCE_FILES}
-#)
-#
-#set_target_properties(plugin_process_launcher
-#    PROPERTIES
-#    WIN32_EXECUTABLE
-#    FALSE
-#)
-#
-#target_link_libraries(plugin_process_launcher
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLMESSAGE_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#  ${PLUGIN_API_WINDOWS_LIBRARIES}
-#)
-#
-#add_dependencies(plugin_process_launcher
-#  SLPlugin
-#  demo_plugin
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLMESSAGE_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#)
-
-### media_simple_test
-
-#set(media_simple_test_SOURCE_FILES
-#    media_simple_test.cpp
-#    )
-#
-#add_executable(media_simple_test
-#    WIN32
-#    ${media_simple_test_SOURCE_FILES}
-#)
-#
-#add_dependencies(media_simple_test stage_third_party_libs)
-#
-#set_target_properties(media_simple_test
-#    PROPERTIES
-#    WIN32_EXECUTABLE
-#    FALSE
-#)
-#
-#target_link_libraries(media_simple_test
-#  ${GLUT_LIBRARY}
-#  ${OPENGL_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#)
-
-### media_plugin_test
-
-#set(media_plugin_test_SOURCE_FILES
-#    media_plugin_test.cpp
-#    )
-#
-#add_executable(media_plugin_test
-#    WIN32
-#    ${media_plugin_test_SOURCE_FILES}
-#)
-#
-#set_target_properties(media_plugin_test
-#    PROPERTIES
-#    WIN32_EXECUTABLE
-#    FALSE
-#)
-#
-#target_link_libraries(media_plugin_test
-#  ${GLUT_LIBRARY}
-#  ${OPENGL_LIBRARIES}
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLMESSAGE_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#  ${PLUGIN_API_WINDOWS_LIBRARIES}
-#)
-#
-#add_dependencies(media_plugin_test
-#  stage_third_party_libs
-#  SLPlugin
-#  demo_media_plugin
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLMESSAGE_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#)
-
-### demo_media_plugin
-
-#set(demo_media_plugin_SOURCE_FILES
-#    demo_media_plugin.cpp
-#    )
-#
-#add_library(demo_media_plugin
-#    SHARED
-#    ${demo_media_plugin_SOURCE_FILES}
-#)
-#
-#target_link_libraries(demo_media_plugin
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#  ${PLUGIN_API_WINDOWS_LIBRARIES}
-#)
-#
-#add_dependencies(demo_media_plugin
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#)
-#
-#if (DARWIN)
-#  # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name
-#  set_target_properties(
-#    demo_media_plugin
-#    PROPERTIES
-#    PREFIX ""
-#    BUILD_WITH_INSTALL_RPATH 1
-#    INSTALL_NAME_DIR "@executable_path"
-#  )
-#endif (DARWIN)
-
-### demo_media_plugin_2
-
-#set(demo_media_plugin_2_SOURCE_FILES
-#    demo_media_plugin_2.cpp
-#    )
-#
-#add_library(demo_media_plugin_2
-#    SHARED
-#    ${demo_media_plugin_2_SOURCE_FILES}
-#)
-#
-#target_link_libraries(demo_media_plugin_2
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#  ${PLUGIN_API_WINDOWS_LIBRARIES}
-#)
-#
-#add_dependencies(demo_media_plugin_2
-#  ${LLPLUGIN_LIBRARIES}
-#  ${LLCOMMON_LIBRARIES}
-#)
-#
-#if (DARWIN)
-#  # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name
-#  set_target_properties(
-#    demo_media_plugin_2
-#    PROPERTIES
-#    PREFIX ""
-#    BUILD_WITH_INSTALL_RPATH 1
-#    INSTALL_NAME_DIR "@executable_path"
-#  )
-#endif (DARWIN)
-
-# Gather build products of the various dependencies into the build directory for the testbed.
-
-if(WINDOWS)
-  #********************
-  # Plugin test library deploy
-  #
-  # Debug config runtime files required for the plugin test mule
-  set(plugintest_debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}")
-  set(plugintest_debug_files
-    libeay32.dll
-    libglib-2.0-0.dll
-    libgmodule-2.0-0.dll
-    libgobject-2.0-0.dll
-    libgthread-2.0-0.dll
-    ssleay32.dll
-    )
-  copy_if_different(
-    ${plugintest_debug_src_dir}
-    "${CMAKE_CURRENT_BINARY_DIR}/Debug"
-    out_targets
-    ${plugintest_debug_files}
-    )
-  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
-  
-  # Release & ReleaseDebInfo config runtime files required for the plugin test mule
-  set(plugintest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
-  set(plugintest_release_files
-    libeay32.dll
-    libglib-2.0-0.dll
-    libgmodule-2.0-0.dll
-    libgobject-2.0-0.dll
-    libgthread-2.0-0.dll
-    ssleay32.dll
-    )
-  copy_if_different(
-    ${plugintest_release_src_dir}
-    "${CMAKE_CURRENT_BINARY_DIR}/Release"
-    out_targets
-    ${plugintest_release_files}
-    )
-  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
-
-  copy_if_different(
-    ${plugintest_release_src_dir}
-    "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
-    out_targets
-    ${plugintest_release_files}
-    )
-  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
-
-   add_custom_target(copy_plugintest_libs ALL
-     DEPENDS 
-     ${plugin_test_targets}
-     )
-
-endif(WINDOWS)
-
-if (DARWIN)
-  set(plugintest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
-  set(plugintest_release_files
-    libexception_handler.dylib
-    libaprutil-1.0.dylib
-    libapr-1.0.dylib
-    libexpat.1.5.2.dylib
-    )
-  copy_if_different(
-    ${plugintest_release_src_dir}
-    "${PLUGINS_DESTINATION_DIR}"
-    out_targets
-    ${plugintest_release_files}
-    )
-  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
-
-  add_custom_target(copy_plugintest_libs ALL
-    DEPENDS 
-    ${plugin_test_targets}
-    )
-
-endif (DARWIN)
-
diff --git a/indra/test_apps/llplugintest/README.Linden b/indra/test_apps/llplugintest/README.Linden
deleted file mode 100644
index 4a9f223c21..0000000000
--- a/indra/test_apps/llplugintest/README.Linden
+++ /dev/null
@@ -1,21 +0,0 @@
-
-1.  Description
-
-    Exercises SLPlugin.  Demonstrates mediakit plugin reuse and
-    switchover as MIME type changes (web, quicktime, flash).
-
-
-2.  Running
-
-  2.1  Mac
-
-    Make certain '.' is included in PATH.  E.g.:
-
-       PATH=.:"$PATH" open build-darwin-i386/test_apps/llmediaplugintest/RelWithDebInfo/llmediaplugintest.app
-
-    Otherwise the program won't find SLPlugin and will timeout and
-    fail after 30 seconds and give you little information as to why.
-
-    Running 'dtruss' on plugin test applications will give you a great
-    deal of insight into why they aren't activating.
-
diff --git a/indra/test_apps/llplugintest/bookmarks.txt b/indra/test_apps/llplugintest/bookmarks.txt
deleted file mode 100755
index 2ff64f217f..0000000000
--- a/indra/test_apps/llplugintest/bookmarks.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# format is description, url (don't put ',' chars in description :)
-# if no ',' found, whole line is used for both description and url
-(WK) Google Home Page,http://www.google.com
-(WK) BBC News Home Page,http://news.bbc.co.uk
-(WK) Second Life,http://secondlife.com
-(WK) WebKit Home ,http://www.webkit.org
-(WK) Yahoo News,http://news.yahoo.com
-(WK) Canvas Paint (DHTML version of MS Paint),http://www.canvaspaint.org
-(WK) DHTML Lemmings!,http://www.elizium.nu/scripts/lemmings/
-(WK) DHTML graphics demos,http://www.dhteumeuleu.com/
-(WK) Shared paint app,http://colorillo.com/ac79?1l0q6cp
-(Flash) YouTube,http://youtube.com
-(Flash) Vimeo,http://www.vimeo.com/1778399
-(Flash) Simple whiteboard,http://www.imaginationcubed.com/
-(Flash) Dabble Board,http://www.dabbleboard.com/draw
-(Flash) Bubble Shooter game,http://www.wiicade.com/playGame.aspx?gameID=72&gameName=Bubble%20Shooter 
-(Flash) Pixlr photo editor,http://pixlr.com/editor/
-(Flash) Scribd,http://www.scribd.com/doc/14427744/Second-Life-Quickstart-Guide
-(Flash) MAME,http://yvern.com/fMAME/fMAME.html
-(QT) Local sample,file:///C|/Program Files/QuickTime/Sample.mov
-(QT) Movie - Watchmen Trailer,http://trailers.apple.com/movies/wb/watchmen/watchmen-tlr2_480p.mov
-(QT) Movie - Transformers - Revenge of the Fallen,http://trailers.apple.com/movies/paramount/transformers2/transformersrevengeofthefallen-tlr1_h.320.mov
-(QT) Movie - Terminator Salvation,http://trailers.apple.com/movies/wb/terminatorsalvation/terminatorsalvation-tlr3_h.320.mov
-(QT) Movie - Angels and Demons,http://trailers.apple.com/movies/sony_pictures/angelsanddemons/angelsanddemons-video_h.320.mov
-(QT) Movie - Sin City Trailer,http://trailers.apple.com/movies/miramax/sin_city/sin_city_480.mov
-(QT) Movie - The Incredibles Trailer,http://trailers.apple.com/movies/disney/the_incredibles/the_incredibles-tlr_a480.mov
-(QT) Movie - Streaming Apple Event,http://stream.qtv.apple.com/events/mar/0903lajkszg/m_090374535329zdwg_650_ref.mov
-(QT) Movie - MPEG-4 from Amazon S3,http://s3.amazonaws.com/callum-linden/flashdemo/interactive_flash_demo.mp4
-(QT) Movie - Star Trek,http://trailers.apple.com/movies/paramount/star_trek/startrek-tlr3_h.320.mov
-(QT) Movie - Ice Age 3,http://trailers.apple.com/movies/fox/ice_age_iii/iceage3-tlrd_h.320.mov
-(QT) Movie - AstroBoy,http://trailers.apple.com/movies/summit/astroboy/astroboy-tsr_h.320.mov
-(QT) Movie - Ante Up,http://trailers.apple.com/movies/independent/anteup/anteup_h.320.mov
-(QT) Movie - Every Little Step,http://trailers.apple.com/movies/sony/everylittlestep/everylittlestep-clip_h.320.mov
-(QT) Movie - The Informers,http://trailers.apple.com/movies/independent/theinformers/theinformers_h.320.mov
-(QT) Animated GIF,http://upload.wikimedia.org/wikipedia/commons/4/44/Optical.greysquares.arp-animated.gif
-(QT) Apple Text Descriptors,http://ubrowser.com/tmp/apple_text.txt
-(EX) Example Plugin,example://blah
-- 
cgit v1.2.3


From cfba9a9dca8e31da2a792a2e70944a47359c9a21 Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Thu, 21 Apr 2016 11:58:01 -0700
Subject: DRTVWR-418 remove references to some misc files I missed

---
 indra/cmake/CMakeLists.txt        |  3 --
 indra/cmake/Glui.cmake            | 28 ------------------
 indra/cmake/Glut.cmake            | 19 ------------
 indra/cmake/GooglePerfTools.cmake | 61 ---------------------------------------
 4 files changed, 111 deletions(-)
 delete mode 100755 indra/cmake/Glui.cmake
 delete mode 100755 indra/cmake/Glut.cmake
 delete mode 100755 indra/cmake/GooglePerfTools.cmake

(limited to 'indra')

diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index a10a5a7895..a7ee0f1866 100755
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -23,7 +23,6 @@ set(cmake_SOURCE_FILES
     DirectX.cmake
     DragDrop.cmake
     EXPAT.cmake
-##  ExamplePlugin.cmake
     FindAPR.cmake
     FindAutobuild.cmake
     FindBerkeleyDB.cmake
@@ -46,8 +45,6 @@ set(cmake_SOURCE_FILES
     GLOD.cmake
 ##  GStreamer010Plugin.cmake
     GetPrerequisites_2_8.cmake
-##  Glui.cmake
-    Glut.cmake
     GoogleBreakpad.cmake
     GoogleMock.cmake
     GooglePerfTools.cmake
diff --git a/indra/cmake/Glui.cmake b/indra/cmake/Glui.cmake
deleted file mode 100755
index db353a91ec..0000000000
--- a/indra/cmake/Glui.cmake
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- cmake -*-
-include(Linking)
-include(Prebuilt)
-
-if (USESYSTEMLIBS)
-    set(GLUI OFF CACHE BOOL
-        "GLUI support for the llplugin/llmedia test apps.")
-else (USESYSTEMLIBS)
-    use_prebuilt_binary(glui)
-    set(GLUI ON CACHE BOOL
-        "GLUI support for the llplugin/llmedia test apps.")
-endif (USESYSTEMLIBS)
-
-if (LINUX)
-    set(GLUI ON CACHE BOOL
-        "llplugin media apps HACK for Linux.")
-endif (LINUX)
-
-if (DARWIN OR LINUX)
-    set(GLUI_LIBRARY
-        glui)
-endif (DARWIN OR LINUX)
-
-if (WINDOWS)
-    set(GLUI_LIBRARY
-        debug glui32.lib
-        optimized glui32.lib)
-endif (WINDOWS)
diff --git a/indra/cmake/Glut.cmake b/indra/cmake/Glut.cmake
deleted file mode 100755
index 314da30652..0000000000
--- a/indra/cmake/Glut.cmake
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- cmake -*-
-include(Linking)
-include(Prebuilt)
-
-if (WINDOWS)
-    use_prebuilt_binary(freeglut)
-    set(GLUT_LIBRARY
-        debug freeglut_static.lib
-        optimized freeglut_static.lib)
-endif (WINDOWS)
-
-if (LINUX)
-  FIND_LIBRARY(GLUT_LIBRARY glut)
-endif (LINUX)
-
-if (DARWIN)
-  include(CMakeFindFrameworks)
-  find_library(GLUT_LIBRARY GLUT)
-endif (DARWIN)
diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake
deleted file mode 100755
index c1faeb9325..0000000000
--- a/indra/cmake/GooglePerfTools.cmake
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- cmake -*-
-include(Prebuilt)
-
-# If you want to enable or disable TCMALLOC in viewer builds, this is the place.
-# set ON or OFF as desired.
-set (USE_TCMALLOC OFF)
-
-if (USESYSTEMLIBS)
-  include(FindGooglePerfTools)
-else (USESYSTEMLIBS)
-  if (WINDOWS)
-    if (USE_TCMALLOC)
-       use_prebuilt_binary(gperftools)
-       set(TCMALLOC_LIBRARIES 
-         debug libtcmalloc_minimal-debug
-         optimized libtcmalloc_minimal)
-       set(TCMALLOC_LINK_FLAGS  "/INCLUDE:__tcmalloc")
-    else (USE_TCMALLOC)
-      set(TCMALLOC_LIBRARIES)
-      set(TCMALLOC_LINK_FLAGS)
-    endif (USE_TCMALLOC)
-    set(GOOGLE_PERFTOOLS_FOUND "YES")
-  endif (WINDOWS)
-  if (LINUX)
-    if (USE_TCMALLOC)
-      use_prebuilt_binary(gperftools)
-      set(TCMALLOC_LIBRARIES 
-        tcmalloc)
-    else (USE_TCMALLOC)
-      set(TCMALLOC_LIBRARIES)
-    endif (USE_TCMALLOC)
-    set(PROFILER_LIBRARIES profiler)
-    set(GOOGLE_PERFTOOLS_INCLUDE_DIR
-        ${LIBS_PREBUILT_DIR}/include)
-    set(GOOGLE_PERFTOOLS_FOUND "YES")
-  endif (LINUX)
-endif (USESYSTEMLIBS)
-
-if (GOOGLE_PERFTOOLS_FOUND)
-  # XXX Disable temporarily, until we have compilation issues on 64-bit
-  # Etch sorted.
-  set(USE_GOOGLE_PERFTOOLS OFF CACHE BOOL "Build with Google PerfTools support.")
-endif (GOOGLE_PERFTOOLS_FOUND)
-
-if (WINDOWS)
-   set(USE_GOOGLE_PERFTOOLS ON)
-endif (WINDOWS)
-
-if (USE_GOOGLE_PERFTOOLS)
-  if (USE_TCMALLOC)
-    set(TCMALLOC_FLAG -DLL_USE_TCMALLOC=1)
-  else (USE_TCMALLOC)
-    set(TCMALLOC_FLAG -ULL_USE_TCMALLOC)
-  endif (USE_TCMALLOC)
-endif (USE_GOOGLE_PERFTOOLS)
-
-if (USE_GOOGLE_PERFTOOLS)
-  include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR})
-  set(GOOGLE_PERFTOOLS_LIBRARIES ${TCMALLOC_LIBRARIES} ${STACKTRACE_LIBRARIES} ${PROFILER_LIBRARIES})
-else (USE_GOOGLE_PERFTOOLS)
-endif (USE_GOOGLE_PERFTOOLS)
-- 
cgit v1.2.3


From b50df60aa180e904aa0733bb60cef91cf9df6ff6 Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Thu, 21 Apr 2016 16:13:39 -0700
Subject: DRTVWR-418 remove vestiges of TCMALLOC and GooglePerfTools from the
 viewer

---
 indra/cmake/CMakeLists.txt              |  2 --
 indra/cmake/Copy3rdPartyLibs.cmake      | 48 +++++++++++++--------------------
 indra/cmake/LLCommon.cmake              |  3 ---
 indra/llcommon/CMakeLists.txt           |  5 ----
 indra/llcommon/llallocator.cpp          | 43 -----------------------------
 indra/llcommon/llmemory.h               |  8 ------
 indra/llcorehttp/CMakeLists.txt         |  2 +-
 indra/newview/CMakeLists.txt            | 16 +----------
 indra/newview/app_settings/settings.xml | 11 --------
 indra/newview/viewer_manifest.py        |  5 +---
 indra/test/CMakeLists.txt               |  1 -
 11 files changed, 22 insertions(+), 122 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index a7ee0f1866..8d3eb4832e 100755
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -29,7 +29,6 @@ set(cmake_SOURCE_FILES
     FindFMODEX.cmake
     FindGLH.cmake
     FindGoogleBreakpad.cmake
-    FindGooglePerfTools.cmake
     FindHUNSPELL.cmake
     FindJsonCpp.cmake
     FindNDOF.cmake
@@ -47,7 +46,6 @@ set(cmake_SOURCE_FILES
     GetPrerequisites_2_8.cmake
     GoogleBreakpad.cmake
     GoogleMock.cmake
-    GooglePerfTools.cmake
     Havok.cmake
     Hunspell.cmake
     JPEG.cmake
diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake
index 70d85b864c..4c1fb087e7 100755
--- a/indra/cmake/Copy3rdPartyLibs.cmake
+++ b/indra/cmake/Copy3rdPartyLibs.cmake
@@ -30,21 +30,20 @@ if(WINDOWS)
     #*******************************
     # Misc shared libs 
 
-    set(debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}")
-    set(debug_files
-        openjpegd.dll
-        libapr-1.dll
-        libaprutil-1.dll
-        libapriconv-1.dll
-        ssleay32.dll
-        libeay32.dll
-        glod.dll    
-        libhunspell.dll
-        )
+#    set(debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}")
+#    set(debug_files
+#        libapr-1.dll
+#        libaprutil-1.dll
+#        libapriconv-1.dll
+#        ssleay32.dll
+#        libeay32.dll
+#        glod.dll    
+#        libhunspell.dll
+#        )
 
     set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
     set(release_files
-        openjpeg.dll
+        openjp2.dll
         libapr-1.dll
         libaprutil-1.dll
         libapriconv-1.dll
@@ -54,13 +53,8 @@ if(WINDOWS)
         libhunspell.dll
         )
 
-    if(USE_TCMALLOC)
-      set(debug_files ${debug_files} libtcmalloc_minimal-debug.dll)
-      set(release_files ${release_files} libtcmalloc_minimal.dll)
-    endif(USE_TCMALLOC)
-
     if (FMODEX)
-      set(debug_files ${debug_files} fmodexL.dll)
+#      set(debug_files ${debug_files} fmodexL.dll)
       set(release_files ${release_files} fmodex.dll)
     endif (FMODEX)
 
@@ -234,10 +228,6 @@ elseif(LINUX)
         libfontconfig.so.1
        )
 
-    if (USE_TCMALLOC)
-      set(release_files ${release_files} "libtcmalloc_minimal.so")
-    endif (USE_TCMALLOC)
-
     if (FMODEX)
       set(debug_files ${debug_files} "libfmodexL.so")
       set(release_files ${release_files} "libfmodex.so")
@@ -294,13 +284,13 @@ set(third_party_targets ${third_party_targets} ${out_targets})
 
 
 
-copy_if_different(
-    ${debug_src_dir}
-    "${SHARED_LIB_STAGING_DIR_DEBUG}"
-    out_targets
-    ${debug_files}
-    )
-set(third_party_targets ${third_party_targets} ${out_targets})
+#copy_if_different(
+#    ${debug_src_dir}
+#    "${SHARED_LIB_STAGING_DIR_DEBUG}"
+#    out_targets
+#    ${debug_files}
+#    )
+#set(third_party_targets ${third_party_targets} ${out_targets})
 
 copy_if_different(
     ${release_src_dir}
diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake
index b50b4bcdb2..3e29297c58 100755
--- a/indra/cmake/LLCommon.cmake
+++ b/indra/cmake/LLCommon.cmake
@@ -4,7 +4,6 @@ include(APR)
 include(Boost)
 include(EXPAT)
 include(ZLIB)
-include(GooglePerfTools)
 
 set(LLCOMMON_INCLUDE_DIRS
     ${LIBS_OPEN_DIR}/llcommon
@@ -34,8 +33,6 @@ else (LINUX)
         ${BOOST_SYSTEM_LIBRARY} )
 endif (LINUX)
 
-# add_definitions(${TCMALLOC_FLAG})
-
 set(LLCOMMON_LINK_SHARED OFF CACHE BOOL "Build the llcommon target as a static library.")
 if(LLCOMMON_LINK_SHARED)
   add_definitions(-DLL_COMMON_LINK_SHARED=1)
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 907dbab8f8..1e75ede4e1 100755
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -10,7 +10,6 @@ include(Boost)
 include(LLSharedLibs)
 include(JsonCpp)
 include(GoogleBreakpad)
-include(GooglePerfTools)
 include(Copy3rdPartyLibs)
 include(ZLIB)
 include(URIPARSER)
@@ -328,8 +327,4 @@ if (LL_TESTS)
   LL_ADD_INTEGRATION_TEST(llleap "" "${test_libs}")
   LL_ADD_INTEGRATION_TEST(llstreamqueue "" "${test_libs}")
 
-  # *TODO - reenable these once tcmalloc libs no longer break the build.
-  #ADD_BUILD_TEST(llallocator llcommon)
-  #ADD_BUILD_TEST(llallocator_heap_profile llcommon)
-  #ADD_BUILD_TEST(llmemtype llcommon)
 endif (LL_TESTS)
diff --git a/indra/llcommon/llallocator.cpp b/indra/llcommon/llallocator.cpp
index 34fc28d8cc..ac97fb71dd 100755
--- a/indra/llcommon/llallocator.cpp
+++ b/indra/llcommon/llallocator.cpp
@@ -27,47 +27,6 @@
 #include "linden_common.h"
 #include "llallocator.h"
 
-#if (LL_USE_TCMALLOC && LL_USE_HEAP_PROFILER)
-
-#include "google/heap-profiler.h"
-#include "google/commandlineflags_public.h"
-
-DECLARE_bool(heap_profile_use_stack_trace);
-//DECLARE_double(tcmalloc_release_rate);
-
-void LLAllocator::setProfilingEnabled(bool should_enable)
-{
-    // NULL disables dumping to disk
-    static char const * const PREFIX = NULL;
-    if(should_enable)
-    {
-		HeapProfilerSetUseStackTrace(false);
-        HeapProfilerStart(PREFIX);
-    }
-    else
-    {
-        HeapProfilerStop();
-    }
-}
-
-// static
-bool LLAllocator::isProfiling()
-{
-    return IsHeapProfilerRunning();
-}
-
-std::string LLAllocator::getRawProfile()
-{
-    // *TODO - fix google-perftools to accept an buffer to avoid this
-    // malloc-copy-free cycle.
-    char * buffer = GetHeapProfile();
-    std::string ret = buffer;
-    free(buffer);
-    return ret;
-}
-
-#else // LL_USE_TCMALLOC
-
 //
 // stub implementations for when tcmalloc is disabled
 //
@@ -87,8 +46,6 @@ std::string LLAllocator::getRawProfile()
     return std::string();
 }
 
-#endif // LL_USE_TCMALLOC
-
 LLAllocatorHeapProfile const & LLAllocator::getProfile()
 {
     mProf.mLines.clear();
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 0fb257aab1..99acc76dac 100755
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -134,7 +134,6 @@ template <typename T> T* LL_NEXT_ALIGNED_ADDRESS_64(T* address)
 //------------------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------------------
 
-#if !LL_USE_TCMALLOC
 inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed with ll_aligned_free_16().
 {
 #if defined(LL_WINDOWS)
@@ -183,13 +182,6 @@ inline void* ll_aligned_realloc_16(void* ptr, size_t size, size_t old_size) // r
 #endif
 }
 
-#else // USE_TCMALLOC
-// ll_aligned_foo_16 are not needed with tcmalloc
-#define ll_aligned_malloc_16 malloc
-#define ll_aligned_realloc_16(a,b,c) realloc(a,b)
-#define ll_aligned_free_16 free
-#endif // USE_TCMALLOC
-
 inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed with ll_aligned_free_32().
 {
 #if defined(LL_WINDOWS)
diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt
index 0bb0348d26..6f362df921 100755
--- a/indra/llcorehttp/CMakeLists.txt
+++ b/indra/llcorehttp/CMakeLists.txt
@@ -213,7 +213,7 @@ endif (DARWIN)
     # The following come from LLAddBuildTest.cmake's INTEGRATION_TEST_xxxx target.
     set_target_properties(http_texture_load
                           PROPERTIES
-                          LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE ${TCMALLOC_LINK_FLAGS}"
+                          LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE"
                           LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO"
                           LINK_FLAGS_RELEASE ""
                           )
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index bb745bcb43..158233ca47 100755
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -13,7 +13,6 @@ include(DragDrop)
 include(EXPAT)
 include(FMODEX)
 include(GLOD)
-include(GooglePerfTools)
 include(Hunspell)
 include(JsonCpp)
 include(LLAppearance)
@@ -1671,7 +1670,7 @@ if (WINDOWS)
     set_target_properties(${VIEWER_BINARY_NAME}
         PROPERTIES
         # *TODO -reenable this once we get server usage sorted out
-        LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS ${TCMALLOC_LINK_FLAGS} /LARGEADDRESSAWARE"
+        LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /LARGEADDRESSAWARE"
         LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO /LARGEADDRESSAWARE"
         LINK_FLAGS_RELEASE "/FORCE:MULTIPLE /MAP\"secondlife-bin.MAP\" /OPT:REF /LARGEADDRESSAWARE"
         )
@@ -1693,20 +1692,8 @@ if (WINDOWS)
     # In the meantime, if you have any ideas on how to easily maintain one list, either here or in viewer_manifest.py
     # and have the build deps get tracked *please* tell me about it.
 
-    if(USE_TCMALLOC)
-      # Configure a var for tcmalloc location, if used.
-      # Note the need to specify multiple names explicitly.
-      set(GOOGLE_PERF_TOOLS_SOURCE
-        ${SHARED_LIB_STAGING_DIR}/Release/libtcmalloc_minimal.dll
-        ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll
-        ${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll
-        )
-     endif(USE_TCMALLOC)
-
-
     set(COPY_INPUT_DEPENDENCIES
       # The following commented dependencies are determined at variably at build time. Can't do this here.
-      #${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libtcmalloc_minimal.dll => None ... Skipping libtcmalloc_minimal.dll
       ${CMAKE_SOURCE_DIR}/../etc/message.xml
       ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg
       ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/llcommon.dll
@@ -1948,7 +1935,6 @@ target_link_libraries(${VIEWER_BINARY_NAME}
     ${LLLOGIN_LIBRARIES}
     ${LLPHYSICS_LIBRARIES}
     ${LLPHYSICSEXTENSIONS_LIBRARIES}
-    ${TCMALLOC_LIBRARIES}
     ${LLAPPEARANCE_LIBRARIES}
     )
 
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index c4a8fe3532..6102c6f15c 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -6321,17 +6321,6 @@
       <key>Value</key>
       <integer>512</integer>
     </map>
-    <key>MemProfiling</key>
-    <map>
-      <key>Comment</key>
-      <string>You want to use tcmalloc's memory profiling options.</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
     <key>MenuAccessKeyTime</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 1c77cf805e..22b0e1ffc1 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -378,10 +378,7 @@ class Windows_i686_Manifest(ViewerManifest):
                 print "Skipping fmodex audio library(assuming other audio engine)"
 
             # For textures
-            if self.args['configuration'].lower() == 'debug':
-                self.path("openjpegd.dll")
-            else:
-                self.path("openjpeg.dll")
+            self.path("openjpeg.dll")
 
             # These need to be installed as a SxS assembly, currently a 'private' assembly.
             # See http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx
diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt
index 229cb8e5a0..8bde5bda63 100755
--- a/indra/test/CMakeLists.txt
+++ b/indra/test/CMakeLists.txt
@@ -104,7 +104,6 @@ target_link_libraries(lltest
     ${BOOST_CONTEXT_LIBRARY}
     ${BOOST_SYSTEM_LIBRARY}
     ${DL_LIBRARY}
-    ${GOOGLE_PERFTOOLS_LIBRARIES}
     )
 
 if (WINDOWS)
-- 
cgit v1.2.3


From d75a6ecbe533fb115d8130122df710790ba9610b Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Fri, 22 Apr 2016 12:58:20 +0200
Subject: Windows x64: Disable warning 4267 (it causes too much noise) and do
 not enable /arch:SSE2 (x64 implies SSE2 and setting the flag causes
 warnings). (transplanted from 5a7cc3874065b13a83b8c7aa044fb07f38edd283)

---
 indra/cmake/00-Common.cmake | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 86fc2dfff5..84d70bd7b1 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -74,9 +74,18 @@ if (WINDOWS)
       /nologo
       /Oy-
       /Zc:wchar_t-
-      /arch:SSE2
+#      /arch:SSE2
       /fp:fast
       )
+
+  # Nicky: x64 implies SSE2
+  if( NOT LL_64BIT_BUILD )
+    add_definitions( /arch:SSE2 )
+  else()
+   # Otherwise disable 4267 ('var' : conversion from 'size_t' to 'type', possible loss of data) 
+   # This warning alas is all over the place and fixing it will touch a lot of code.
+   add_definitions("/wd4267 /DLL_64BIT_BUILD" ) 
+  endif()
      
   # Are we using the crummy Visual Studio KDU build workaround?
   if (NOT VS_DISABLE_FATAL_WARNINGS)
-- 
cgit v1.2.3


From 056f0983029000041555ca53c61cbe5e8689cae9 Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Fri, 22 Apr 2016 12:58:51 +0200
Subject: Windows x64: Cannot use inline assembly. (transplanted from
 ee32840fc591f5529a0b544243e7b4146eb8f531)

---
 indra/llcommon/llfasttimer.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'indra')

diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index f56e5596f5..0336f9d0e9 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -91,6 +91,7 @@ public:
 	static U32 getCPUClockCount32()
 	{
 		U32 ret_val;
+#if !defined(_M_AMD64)
 		__asm
 		{
 			_emit   0x0f
@@ -100,6 +101,11 @@ public:
 				or eax, edx
 				mov dword ptr [ret_val], eax
 		}
+#else
+		unsigned __int64 val = __rdtsc();
+		val = val >> 8;
+		ret_val = static_cast<U32>(val);
+#endif
 		return ret_val;
 	}
 
@@ -107,6 +113,7 @@ public:
 	static U64 getCPUClockCount64()
 	{
 		U64 ret_val;
+#if !defined(_M_AMD64)
 		__asm
 		{
 			_emit   0x0f
@@ -116,6 +123,9 @@ public:
 				mov dword ptr [ret_val+4], edx
 				mov dword ptr [ret_val], eax
 		}
+#else
+		ret_val = static_cast<U64>( __rdtsc() );
+#endif
 		return ret_val;
 	}
 
-- 
cgit v1.2.3


From 637dc1f5a98e1c6cc6eecfb476ab1c20dca0c6aa Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Fri, 22 Apr 2016 12:59:41 +0200
Subject: Windows x64: 64 bit implies SSE2, handle this accordingly when
 detecting if SSE2 is enabled. (transplanted from
 93492b84cb752dc79c74d9667f11edd76ace8f0b)

---
 indra/llmath/llsimdmath.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h
index cebd2ace7d..9f078ec1ef 100644
--- a/indra/llmath/llsimdmath.h
+++ b/indra/llmath/llsimdmath.h
@@ -31,7 +31,7 @@
 #error "Please include llmath.h before this file."
 #endif
 
-#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 ) )
+#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 && !_M_AMD64 ) )
 #error SSE2 not enabled. LLVector4a and related class will not compile.
 #endif
 
-- 
cgit v1.2.3


From 7640c2fb446846005a191abb62d3cce1a64d2a6e Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Fri, 22 Apr 2016 12:59:59 +0200
Subject: Windows x64: Cannot use inline assembly. (transplanted from
 0b621f8a1ee707527325eb70e59ef02c63e2bd10)

---
 indra/llmath/llmath.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index 93b9f22b25..b66a3c63d6 100644
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -153,7 +153,7 @@ inline F64 llabs(const F64 a)
 
 inline S32 lltrunc( F32 f )
 {
-#if LL_WINDOWS && !defined( __INTEL_COMPILER )
+#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined( _M_AMD64 )
 		// Avoids changing the floating point control word.
 		// Add or subtract 0.5 - epsilon and then round
 		const static U32 zpfp[] = { 0xBEFFFFFF, 0x3EFFFFFF };
@@ -179,7 +179,7 @@ inline S32 lltrunc( F64 f )
 
 inline S32 llfloor( F32 f )
 {
-#if LL_WINDOWS && !defined( __INTEL_COMPILER )
+#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined( _M_AMD64 )
 		// Avoids changing the floating point control word.
 		// Accurate (unlike Stereopsis version) for all values between S32_MIN and S32_MAX and slightly faster than Stereopsis version.
 		// Add -(0.5 - epsilon) and then round
-- 
cgit v1.2.3


From a116f96a2fce19fa7e5dc56316044332c13d97d5 Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Fri, 22 Apr 2016 13:02:37 +0200
Subject: Windows: USe the correct datatypes when calling the Windows API.
 (transplanted from 8b0c42b1a4f0416a17c8ec6078a85c5773f69a25)

---
 indra/llcommon/llprocessor.cpp | 2 +-
 indra/llcommon/llthread.cpp    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index e3e1d0c391..65b4507e2d 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -398,7 +398,7 @@ static F64 calculate_cpu_frequency(U32 measure_msecs)
 	HANDLE hThread = GetCurrentThread();
 	unsigned long dwCurPriorityClass = GetPriorityClass(hProcess);
 	int iCurThreadPriority = GetThreadPriority(hThread);
-	unsigned long dwProcessMask, dwSystemMask, dwNewMask = 1;
+	DWORD_PTR dwProcessMask, dwSystemMask, dwNewMask = 1;
 	GetProcessAffinityMask(hProcess, &dwProcessMask, &dwSystemMask);
 
 	SetPriorityClass(hProcess, REALTIME_PRIORITY_CLASS);
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index c3f235c6ee..52255bfaeb 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -63,7 +63,7 @@ void set_thread_name( DWORD dwThreadID, const char* threadName)
 
 	__try
 	{
-		::RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (DWORD*)&info );
+		::RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (ULONG_PTR*)&info );
 	}
 	__except(EXCEPTION_CONTINUE_EXECUTION)
 	{
-- 
cgit v1.2.3


From 30dcad4b95d355e07f0807360f2e5f65b0460fe3 Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Fri, 22 Apr 2016 14:55:19 +0200
Subject: Windows: 1. GWL_USERDATA must be GWLP_USERDATA to be compatible with
 x86 and x64. (GWL_USERDATA  is deprecated anyway). 3. Replace
 Get/SetWindowLong with Get/SetWindoeLongPtr or placing this into
 GWLP_USERDATA will truncate the pointer. (transplanted from
 5f50745bff03700d3862a6bb1eb5936be0fdc6cd)

---
 indra/llwindow/lldragdropwin32.cpp | 8 ++++----
 indra/llwindow/llwindowwin32.cpp   | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

(limited to 'indra')

diff --git a/indra/llwindow/lldragdropwin32.cpp b/indra/llwindow/lldragdropwin32.cpp
index d00d9ab47e..0d1a47408b 100644
--- a/indra/llwindow/lldragdropwin32.cpp
+++ b/indra/llwindow/lldragdropwin32.cpp
@@ -113,7 +113,7 @@ class LLDragDropWin32Target:
 					PVOID data = GlobalLock( stgmed.hGlobal );
 					mDropUrl = std::string( (char*)data );
 					// XXX MAJOR MAJOR HACK!
-					LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA);
+					LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA );
 					if (NULL != window_imp)
 					{
 						LLCoordGL gl_coord( 0, 0 );
@@ -168,7 +168,7 @@ class LLDragDropWin32Target:
 			if ( mAllowDrop )
 			{
 				// XXX MAJOR MAJOR HACK!
-				LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA);
+				LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA );
 				if (NULL != window_imp)
 				{
 					LLCoordGL gl_coord( 0, 0 );
@@ -215,7 +215,7 @@ class LLDragDropWin32Target:
 		HRESULT __stdcall DragLeave( void )
 		{
 			// XXX MAJOR MAJOR HACK!
-			LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA);
+			LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA );
 			if (NULL != window_imp)
 			{
 				LLCoordGL gl_coord( 0, 0 );
@@ -232,7 +232,7 @@ class LLDragDropWin32Target:
 			if ( mAllowDrop )
 			{
 				// window impl stored in Window data (neat!)
-				LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong( mAppWindowHandle, GWL_USERDATA );
+				LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( mAppWindowHandle, GWLP_USERDATA );
 				if ( NULL != window_imp )
 				{
 					POINT pt_client;
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 875ffe4cd4..d111bea3fd 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -759,7 +759,7 @@ void LLWindowWin32::close()
 	LL_DEBUGS("Window") << "Destroying Window" << LL_ENDL;
 	
 	// Don't process events in our mainWindowProc any longer.
-	SetWindowLong(mWindowHandle, GWL_USERDATA, NULL);
+	SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, NULL);
 
 	// Make sure we don't leave a blank toolbar button.
 	ShowWindow(mWindowHandle, SW_HIDE);
@@ -1538,7 +1538,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
 		LL_DEBUGS("Window") << "Keeping vertical sync" << LL_ENDL;
 	}
 
-	SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this);
+	SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, (LONG_PTR)this);
 
 	// register this window as handling drag/drop events from the OS
 	DragAcceptFiles( mWindowHandle, TRUE );
@@ -1850,7 +1850,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 	// This is to avoid triggering double click teleport after returning focus (see MAINT-3786).
 	static bool sHandleDoubleClick = true;
 
-	LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(h_wnd, GWL_USERDATA);
+	LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLongPtr( h_wnd, GWLP_USERDATA );
 
 
 	if (NULL != window_imp)
-- 
cgit v1.2.3


From e8aa2dd71fff7a39f2b03039b23afa8bdf804fcb Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Fri, 22 Apr 2016 14:58:25 +0200
Subject: x64: Do not use a union of LLColor4U. Especially having the two
 pointer in there will blow up the struct to at least 8 byte, which will break
 VBO packing as this class needs to be 4 byte in size. (transplanted from
 847df86d6b5daa69dcfc428df18876a9c1e8bef6)

---
 indra/llimage/llimage.cpp  |  3 ++-
 indra/llmath/v4coloru.h    | 42 ++++++++++++++++++++++++++++++++++--------
 indra/newview/llface.cpp   |  4 ++--
 indra/newview/llnetmap.cpp |  6 +++---
 indra/newview/llvosky.cpp  |  2 +-
 indra/newview/llvosky.h    |  4 ++--
 6 files changed, 44 insertions(+), 17 deletions(-)

(limited to 'indra')

diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index f71607096c..a6cbcc131e 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -1218,9 +1218,10 @@ void LLImageRaw::fill( const LLColor4U& color )
 	if( 4 == getComponents() )
 	{
 		U32* data = (U32*) getData();
+		U32 rgbaColor = color.asRGBA();
 		for( S32 i = 0; i < pixels; i++ )
 		{
-			data[i] = color.mAll;
+			data[ i ] = rgbaColor;
 		}
 	}
 	else
diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h
index fddad34978..31ae3e3c1a 100644
--- a/indra/llmath/v4coloru.h
+++ b/indra/llmath/v4coloru.h
@@ -47,14 +47,7 @@ class LLColor4U
 {
 public:
 
-	union
-	{
-		U8         mV[LENGTHOFCOLOR4U];
-		U32        mAll;
-		LLColor4*  mSources;
-		LLColor4U* mSourcesU;
-	};
-
+	U8 mV[LENGTHOFCOLOR4U];
 
 	LLColor4U();						// Initializes LLColor4U to (0, 0, 0, 1)
 	LLColor4U(U8 r, U8 g, U8 b);		// Initializes LLColor4U to (r, g, b, 1)
@@ -132,6 +125,9 @@ public:
 		return LLColor4(*this);
 	}
 
+	U32 asRGBA() const;
+	void fromRGBA( U32 aVal );
+
 	static LLColor4U white;
 	static LLColor4U black;
 	static LLColor4U red;
@@ -565,6 +561,36 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color)
 	mV[3] = 255;
 }
 
+inline U32 LLColor4U::asRGBA() const
+{
+	U32 nRet( 0 );
+
+	// Little endian: values are swapped in memory. The original code access the array like a U32, so we need to swap here
+
+	nRet |= mV[ 3 ];
+	nRet <<= 8;
+	nRet |= mV[ 2 ];
+	nRet <<= 8;
+	nRet |= mV[ 1 ];
+	nRet <<= 8;
+	nRet |= mV[ 0 ];
+
+	return nRet;
+}
+
+inline void LLColor4U::fromRGBA( U32 aVal )
+{
+	// Little endian: values are swapped in memory. The original code access the array like a U32, so we need to swap here
+
+	mV[ 0 ] = aVal & 0xFF;
+	aVal >>= 8;
+	mV[ 1 ] = aVal & 0xFF;
+	aVal >>= 8;
+	mV[ 2 ] = aVal & 0xFF;
+	aVal >>= 8;
+	mV[ 3 ] = aVal & 0xFF;
+}
+
 
 #endif
 
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index de349a03d4..481c66aaf5 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -2132,7 +2132,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 			LLVector4a src;
 
 			U32 vec[4];
-			vec[0] = vec[1] = vec[2] = vec[3] = color.mAll;
+			vec[0] = vec[1] = vec[2] = vec[3] = color.asRGBA();
 		
 			src.loadua((F32*) vec);
 
@@ -2168,7 +2168,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 		
 			LLColor4U glow4u = LLColor4U(0,0,0,glow);
 
-			U32 glow32 = glow4u.mAll;
+			U32 glow32 = glow4u.asRGBA();
 
 			U32 vec[4];
 			vec[0] = vec[1] = vec[2] = vec[3] = glow32;
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 5fc73c67d1..72faa5a9e7 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -735,7 +735,7 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color,
 				continue;
 			}
 			S32 offset = px + py * image_width;
-			((U32*)datap)[offset] = color.mAll;
+			((U32*)datap)[offset] = color.asRGBA();
 		}
 
 		// top line
@@ -748,7 +748,7 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color,
 				continue;
 			}
 			S32 offset = px + py * image_width;
-			((U32*)datap)[offset] = color.mAll;
+			((U32*)datap)[offset] = color.asRGBA();
 		}
 	}
 	else
@@ -770,7 +770,7 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color,
 					continue;
 				}
 				S32 offset = p_x + p_y * image_width;
-				((U32*)datap)[offset] = color.mAll;
+				((U32*)datap)[offset] = color.asRGBA();
 			}
 		}
 	}
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 4dab213fa0..6b4a450e6f 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -283,7 +283,7 @@ void LLSkyTex::create(const F32 brightness)
 			S32 offset = basic_offset * sComponents;
 			U32* pix = (U32*)(data + offset);
 			LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
-			*pix = temp.mAll;
+			*pix = temp.asRGBA();
 		}
 	}
 	createGLImage(sCurrent);
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index ee8e91fb71..9cfb9773bd 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -171,7 +171,7 @@ protected:
 	{
 		S32 offset = (i * sResolution + j) * sComponents;
 		U32* pix = (U32*) &(mImageRaw[sCurrent]->getData()[offset]);
-		*pix = col.mAll;
+		*pix = col.asRGBA();
 	}
 
 	LLColor4U getPixel(const S32 i, const S32 j)
@@ -179,7 +179,7 @@ protected:
 		LLColor4U col;
 		S32 offset = (i * sResolution + j) * sComponents;
 		U32* pix = (U32*) &(mImageRaw[sCurrent]->getData()[offset]);
-		col.mAll = *pix;
+		col.fromRGBA( *pix );
 		return col;
 	}
 
-- 
cgit v1.2.3


From 6b9ceb561c9754c2974e92c66ba15596d490754b Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Fri, 22 Apr 2016 14:34:42 -0700
Subject: DRTVWR-418 Remove references to gtk-atk-pango-glib from Windows build
 since it's not used there

---
 indra/cmake/UI.cmake | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/UI.cmake b/indra/cmake/UI.cmake
index 31174209a3..77fd505df3 100755
--- a/indra/cmake/UI.cmake
+++ b/indra/cmake/UI.cmake
@@ -32,9 +32,9 @@ if (USESYSTEMLIBS)
     add_definitions(${${pkg}_CFLAGS_OTHERS})
   endforeach(pkg)
 else (USESYSTEMLIBS)
-  if (LINUX OR WINDOWS)
+  if (LINUX)
     use_prebuilt_binary(gtk-atk-pango-glib)
-  endif (LINUX OR WINDOWS)
+  endif (LINUX)
 
   if (LINUX)
     set(UI_LIBRARIES
-- 
cgit v1.2.3


From c87d24ac71c662ab37b6b937f92d960c6d8d092f Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Fri, 22 Apr 2016 23:59:28 +0200
Subject: Fasttimers: Windows) Always use the __rdtsc() intrinsic rather than
 inline assembly. Linux/OSX) The rtdsc assembly intruction is clobbering EAX
 and EDX, the snippet was not protecting EDX accordingly. (transplanted from
 6307b134f821390367d4c86a03b9a492ac7ed282)

---
 indra/llcommon/llfasttimer.h | 44 ++++++++------------------------------------
 1 file changed, 8 insertions(+), 36 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index 0336f9d0e9..2024d707da 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -90,43 +90,15 @@ public:
 #if LL_FASTTIMER_USE_RDTSC
 	static U32 getCPUClockCount32()
 	{
-		U32 ret_val;
-#if !defined(_M_AMD64)
-		__asm
-		{
-			_emit   0x0f
-				_emit   0x31
-				shr eax,8
-				shl edx,24
-				or eax, edx
-				mov dword ptr [ret_val], eax
-		}
-#else
 		unsigned __int64 val = __rdtsc();
 		val = val >> 8;
-		ret_val = static_cast<U32>(val);
-#endif
-		return ret_val;
+		return static_cast<U32>(val);
 	}
 
 	// return full timer value, *not* shifted by 8 bits
 	static U64 getCPUClockCount64()
 	{
-		U64 ret_val;
-#if !defined(_M_AMD64)
-		__asm
-		{
-			_emit   0x0f
-				_emit   0x31
-				mov eax,eax
-				mov edx,edx
-				mov dword ptr [ret_val+4], edx
-				mov dword ptr [ret_val], eax
-		}
-#else
-		ret_val = static_cast<U64>( __rdtsc() );
-#endif
-		return ret_val;
+		return static_cast<U64>( __rdtsc() );
 	}
 
 #else
@@ -183,16 +155,16 @@ public:
 	// Mac+Linux+Solaris FAST x86 implementation of CPU clock
 	static U32 getCPUClockCount32()
 	{
-		U64 x;
-		__asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
-		return (U32)(x >> 8);
+		U32 low(0),high(0);
+		__asm__ volatile (".byte 0x0f, 0x31": "=a"(low), "=d"(high) );
+		return (low>>8) | (high<<24);
 	}
 
 	static U64 getCPUClockCount64()
 	{
-		U64 x;
-		__asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
-		return x;
+		U32 low(0),high(0);
+		__asm__ volatile (".byte 0x0f, 0x31": "=a"(low), "=d"(high) );
+		return (U64)low | ( ((U64)high) << 32);
 	}
 
 #endif
-- 
cgit v1.2.3


From a590d1c63ae4c1434da600d60b5c32c9b8a7a1de Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Sun, 24 Apr 2016 12:51:26 +0200
Subject: Windows z64: Disable warning 4267 via llpreprocessor rather than
 cmake files (transplanted from 165fa5852652a1da005cf3b2201c192f028efd43)

---
 indra/cmake/00-Common.cmake     | 4 ----
 indra/llcommon/llpreprocessor.h | 6 ++++++
 2 files changed, 6 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 84d70bd7b1..69d00afda3 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -81,10 +81,6 @@ if (WINDOWS)
   # Nicky: x64 implies SSE2
   if( NOT LL_64BIT_BUILD )
     add_definitions( /arch:SSE2 )
-  else()
-   # Otherwise disable 4267 ('var' : conversion from 'size_t' to 'type', possible loss of data) 
-   # This warning alas is all over the place and fixing it will touch a lot of code.
-   add_definitions("/wd4267 /DLL_64BIT_BUILD" ) 
   endif()
      
   # Are we using the crummy Visual Studio KDU build workaround?
diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h
index 2c4bcc91f6..7c277c2bed 100644
--- a/indra/llcommon/llpreprocessor.h
+++ b/indra/llcommon/llpreprocessor.h
@@ -138,6 +138,12 @@
 #pragma warning( 3      :  4266 )	// 'function' : no override available for virtual member function from base 'type'; function is hidden
 #pragma warning (disable : 4180)	// qualifier applied to function type has no meaning; ignored
 //#pragma warning( disable : 4284 )	// silly MS warning deep inside their <map> include file
+
+#ifdef _M_AMD64
+// That one is all over the place for x64 builds.
+#pragma warning( disable : 4267 )   // 'var' : conversion from 'size_t' to 'type', possible loss of data)
+#endif
+
 #pragma warning( disable : 4503 )	// 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation.
 #pragma warning( disable : 4800 )	// 'BOOL' : forcing value to bool 'true' or 'false' (performance warning)
 #pragma warning( disable : 4996 )	// warning: deprecated
-- 
cgit v1.2.3


From c4e21cf2828517e761657eb70bf516d84f17fc77 Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Sun, 24 Apr 2016 12:55:13 +0200
Subject: Fix a crash is drawn vertices is 0. (transplanted from
 89b3e585218ddb8d6a3e62af29f8daf889371e5e)

---
 indra/llrender/llrender.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 69420dd0bb..0e242a20f6 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -2039,7 +2039,8 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count)
 		}
 	}
 
-	mVerticesp[mCount] = mVerticesp[mCount-1];
+	if( mCount > 0 ) // ND: Guard against crashes if mCount is zero, yes it can happen
+		mVerticesp[mCount] = mVerticesp[mCount-1];
 }
 
 void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count)
-- 
cgit v1.2.3


From 944c497090b09e30377a67d60049c641b5e10e55 Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Sun, 24 Apr 2016 12:55:50 +0200
Subject: Code stylistics. (transplanted from
 570ea799407270069974021eca3a5056d6908f58)

---
 indra/llmath/v4coloru.h | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

(limited to 'indra')

diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h
index 31ae3e3c1a..704ce852d9 100644
--- a/indra/llmath/v4coloru.h
+++ b/indra/llmath/v4coloru.h
@@ -563,19 +563,9 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color)
 
 inline U32 LLColor4U::asRGBA() const
 {
-	U32 nRet( 0 );
-
 	// Little endian: values are swapped in memory. The original code access the array like a U32, so we need to swap here
 
-	nRet |= mV[ 3 ];
-	nRet <<= 8;
-	nRet |= mV[ 2 ];
-	nRet <<= 8;
-	nRet |= mV[ 1 ];
-	nRet <<= 8;
-	nRet |= mV[ 0 ];
-
-	return nRet;
+	return (mV[3] << 24) | (mV[2] << 16) | (mV[1] << 8) | mV[0];
 }
 
 inline void LLColor4U::fromRGBA( U32 aVal )
-- 
cgit v1.2.3


From a0052fac052c527e67f07a978a9413804427a736 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Mon, 25 Apr 2016 22:56:58 -0400
Subject: DRTVWR-418: Fix indra/llkdu wrapper for changes in KDU 7.8 API.

KDU 7.8 introduces a number of changes to its API, most notably by moving
public symbols into a variety of kdu_something namespaces. While this is
laudable in a general sense, it does require quite a bit of diagnostic
building and patching to update legacy code.

Since llimagej2ckdu_test.cpp lamentably stubs out pretty much the entire KDU
API, we must also fix those stubs for signature changes even to functions we
don't otherwise reference.

NOTE: This commit still leaves four symbols undefined. Below I have taken the
liberty of juxtaposing the error line with the output from dumpbin /exports
build-vc120/packages/lib/release/kdu.lib. I see no differences.

unresolved symbol (?kdu_convert_ycc_to_rgb_rev16@kdu_core@@3P6AXPAF00H@ZA)   "void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_rev16)(short *,short *,short *,int)"
                   ?kdu_convert_ycc_to_rgb_rev16@kdu_core@@3P6AXPAF00H@ZA    (void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_rev16)(short *,short *,short *,int))
unresolved symbol (?kdu_convert_ycc_to_rgb_irrev16@kdu_core@@3P6AXPAF00H@ZA) "void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_irrev16)(short *,short *,short *,int)"
                   ?kdu_convert_ycc_to_rgb_irrev16@kdu_core@@3P6AXPAF00H@ZA  (void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_irrev16)(short *,short *,short *,int))
unresolved symbol (?kdu_convert_ycc_to_rgb_rev32@kdu_core@@3P6AXPAH00H@ZA)   "void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_rev32)(int *,int *,int *,int)"
                   ?kdu_convert_ycc_to_rgb_rev32@kdu_core@@3P6AXPAH00H@ZA    (void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_rev32)(int *,int *,int *,int))
unresolved symbol (?kdu_convert_ycc_to_rgb_irrev32@kdu_core@@3P6AXPAM00H@ZA) "void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_irrev32)(float *,float *,float *,int)"
                   ?kdu_convert_ycc_to_rgb_irrev32@kdu_core@@3P6AXPAM00H@ZA  (void (__cdecl* kdu_core::kdu_convert_ycc_to_rgb_irrev32)(float *,float *,float *,int))
24>C:\Users\Nat\linden\viewer64\build-vc120\newview\RelWithDebInfo\secondlife-bin.exe : fatal error LNK1120: 4 unresolved externals
---
 indra/llkdu/include_kdu_xxxx.h           | 40 ++++++++++++++++++++++++++++++++
 indra/llkdu/llimagej2ckdu.cpp            | 22 +++++++++++-------
 indra/llkdu/llimagej2ckdu.h              | 17 ++++----------
 indra/llkdu/llkdumem.cpp                 |  3 +++
 indra/llkdu/llkdumem.h                   | 36 +++++++++++++---------------
 indra/llkdu/tests/llimagej2ckdu_test.cpp | 33 +++++++++++++-------------
 6 files changed, 95 insertions(+), 56 deletions(-)
 create mode 100644 indra/llkdu/include_kdu_xxxx.h

(limited to 'indra')

diff --git a/indra/llkdu/include_kdu_xxxx.h b/indra/llkdu/include_kdu_xxxx.h
new file mode 100644
index 0000000000..5e86944994
--- /dev/null
+++ b/indra/llkdu/include_kdu_xxxx.h
@@ -0,0 +1,40 @@
+/**
+ * @file   include_kdu_xxxx.h
+ * @author Nat Goodspeed
+ * @date   2016-04-25
+ * @brief  
+ * 
+ * $LicenseInfo:firstyear=2016&license=viewerlgpl$
+ * Copyright (c) 2016, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+// This file specifically omits #include guards of its own: it's sort of an
+// #include macro used to wrap KDU #includes with proper incantations. Usage:
+
+// #define kdu_xxxx "kdu_compressed.h" // or whichever KDU header
+// #include "include_kdu_xxxx.h"
+// // kdu_xxxx #undef'ed by include_kdu_xxxx.h
+
+#if LL_DARWIN
+// don't *really* want to rebuild KDU so turn off specific warnings for this header
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wself-assign-field"
+#pragma clang diagnostic ignored "-Wunused-private-field"
+#include kdu_xxxx
+#pragma clang diagnostic pop
+#elif LL_WINDOWS
+// With warnings-as-errors in effect, strange relationship between
+// jp2_output_box and its subclass jp2_target in kdu_compressed.h
+// causes build failures. Specifically:
+// warning C4263: 'void kdu_supp::jp2_target::open(kdu_supp::jp2_family_tgt *)' : member function does not override any base class virtual member function
+// warning C4264: 'void kdu_supp::jp2_output_box::open(kdu_core::kdu_uint32)' : no override available for virtual member function from base 'kdu_supp::jp2_output_box'; function is hidden
+#pragma warning(push)
+#pragma warning(disable : 4263 4264)
+#include kdu_xxxx
+#pragma warning(pop)
+#else // some other platform
+#include kdu_xxxx
+#endif
+
+#undef kdu_xxxx
diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp
index 6a8959517d..f48e544813 100755
--- a/indra/llkdu/llimagej2ckdu.cpp
+++ b/indra/llkdu/llimagej2ckdu.cpp
@@ -32,12 +32,16 @@
 #include "llmath.h"
 #include "llkdumem.h"
 
-#include "kdu_block_coding.h"
+#define kdu_xxxx "kdu_block_coding.h"
+#include "include_kdu_xxxx.h"
+
+// Avoid ubiquitous necessity of kdu_core:: qualification
+using namespace kdu_core;
 
 class kdc_flow_control {
 	
 public:
-	kdc_flow_control(kdu_image_in_base *img_in, kdu_codestream codestream);
+	kdc_flow_control(kdu_supp::kdu_image_in_base *img_in, kdu_codestream codestream);
 	~kdc_flow_control();
 	bool advance_components();
 	void process_components();
@@ -46,7 +50,7 @@ private:
 	
 	struct kdc_component_flow_control {
 	public:
-		kdu_image_in_base *reader;
+		kdu_supp::kdu_image_in_base *reader;
 		int vert_subsampling;
 		int ratio_counter;  /*  Initialized to 0, decremented by `count_delta';
                                 when < 0, a new line must be processed, after
@@ -108,7 +112,8 @@ const char* fallbackEngineInfoLLImageJ2CImpl()
 class LLKDUDecodeState
 {
 public:
-	LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap);
+	LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap,
+					 kdu_codestream* codestreamp);
 	~LLKDUDecodeState();
 	BOOL processTileDecode(F32 decode_time, BOOL limit_time = TRUE);
 
@@ -495,7 +500,7 @@ BOOL LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco
 					kdu_coords offset = tile_dims.pos - dims.pos;
 					int row_gap = channels*dims.size.x; // inter-row separation
 					kdu_byte *buf = buffer + offset.y*row_gap + offset.x*channels;
-					mDecodeState = new LLKDUDecodeState(tile, buf, row_gap);
+					mDecodeState = new LLKDUDecodeState(tile, buf, row_gap, mCodeStreamp);
 				}
 				// Do the actual processing
 				F32 remaining_time = decode_time - decode_timer.getElapsedTimeF32();
@@ -1143,7 +1148,8 @@ all necessary level shifting, type conversion, rounding and truncation. */
 	}
 }
 
-LLKDUDecodeState::LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap)
+LLKDUDecodeState::LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap,
+								   kdu_codestream* codestreamp)
 {
 	S32 c;
 
@@ -1189,7 +1195,7 @@ LLKDUDecodeState::LLKDUDecodeState(kdu_tile tile, kdu_byte *buf, S32 row_gap)
 			mEngines[c] = kdu_synthesis(res,&mAllocator,use_shorts);
 		}
 	}
-	mAllocator.finalize(); // Actually creates buffering resources
+	mAllocator.finalize(*codestreamp); // Actually creates buffering resources
 	for (c = 0; c < mNumComponents; c++)
 	{
 		mLines[c].create(); // Grabs resources from the allocator.
@@ -1247,7 +1253,7 @@ separation between consecutive rows in the real buffer. */
 
 // kdc_flow_control 
 
-kdc_flow_control::kdc_flow_control (kdu_image_in_base *img_in, kdu_codestream codestream)
+kdc_flow_control::kdc_flow_control (kdu_supp::kdu_image_in_base *img_in, kdu_codestream codestream)
 {
 	int n;
 	
diff --git a/indra/llkdu/llimagej2ckdu.h b/indra/llkdu/llimagej2ckdu.h
index 02281152bf..8d66add38f 100755
--- a/indra/llkdu/llimagej2ckdu.h
+++ b/indra/llkdu/llimagej2ckdu.h
@@ -37,15 +37,8 @@
 #include "kdu_messaging.h"
 #include "kdu_params.h"
 
-// don't *really* want to rebuild KDU so turn off specific warnings for this header
-#if LL_DARWIN
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunused-private-field"
-#include "kdu_compressed.h"
-#pragma clang diagnostic pop
-#else
-#include "kdu_compressed.h"
-#endif
+#define kdu_xxxx "kdu_compressed.h"
+#include "include_kdu_xxxx.h"
 
 #include "kdu_sample_processing.h"
 
@@ -80,9 +73,9 @@ private:
 
 	// Encode variable
 	LLKDUMemSource *mInputp;
-	kdu_codestream *mCodeStreamp;
-	kdu_coords *mTPosp; // tile position
-	kdu_dims *mTileIndicesp;
+	kdu_core::kdu_codestream *mCodeStreamp;
+	kdu_core::kdu_coords *mTPosp; // tile position
+	kdu_core::kdu_dims *mTileIndicesp;
 	int mBlocksSize;
 	int mPrecinctsSize;
 	int mLevels;
diff --git a/indra/llkdu/llkdumem.cpp b/indra/llkdu/llkdumem.cpp
index 0347475559..96e9da25d8 100755
--- a/indra/llkdu/llkdumem.cpp
+++ b/indra/llkdu/llkdumem.cpp
@@ -28,6 +28,9 @@
 #include "llkdumem.h"
 #include "llerror.h"
 
+using namespace kdu_core;
+using kd_supp_image_local::image_line_buf;
+
 #if defined(LL_WINDOWS)
 # pragma warning(disable: 4702) // unreachable code
 #endif
diff --git a/indra/llkdu/llkdumem.h b/indra/llkdu/llkdumem.h
index fab913d93b..09d81f38de 100755
--- a/indra/llkdu/llkdumem.h
+++ b/indra/llkdu/llkdumem.h
@@ -29,26 +29,22 @@
 
 // Support classes for reading and writing from memory buffers in KDU
 #define KDU_NO_THREADS
-// don't *really* want to rebuild KDU so turn off specific warnings for this header
-#if LL_DARWIN
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wself-assign-field"
-#pragma clang diagnostic ignored "-Wunused-private-field"
-#include "kdu_image.h"
-#pragma clang diagnostic pop
-#else
-#include "kdu_image.h"
-#endif
+
+#define kdu_xxxx "kdu_image.h"
+#include "include_kdu_xxxx.h"
 
 #include "kdu_elementary.h"
 #include "kdu_messaging.h"
 #include "kdu_params.h"
-#include "kdu_compressed.h"
+
+#define kdu_xxxx "kdu_compressed.h"
+#include "include_kdu_xxxx.h"
+
 #include "kdu_sample_processing.h"
 #include "image_local.h"
 #include "stdtypes.h"
 
-class LLKDUMemSource: public kdu_compressed_source
+class LLKDUMemSource: public kdu_core::kdu_compressed_source
 {
 public:
 	LLKDUMemSource(U8 *input_buffer, U32 size)
@@ -62,7 +58,7 @@ public:
 	{
 	}
 
-	int read(kdu_byte *buf, int num_bytes)
+	int read(kdu_core::kdu_byte *buf, int num_bytes)
 	{
 		U32 num_out;
 		num_out = num_bytes;
@@ -87,7 +83,7 @@ private:
 	U32 mCurPos;
 };
 
-class LLKDUMemTarget: public kdu_compressed_target
+class LLKDUMemTarget: public kdu_core::kdu_compressed_target
 {
 public:
 	LLKDUMemTarget(U8 *output_buffer, U32 &output_size, const U32 buffer_size)
@@ -102,7 +98,7 @@ public:
 	{
 	}
 
-	bool write(const kdu_byte *buf, int num_bytes)
+	bool write(const kdu_core::kdu_byte *buf, int num_bytes)
 	{
 		U32 num_out;
 		num_out = num_bytes;
@@ -126,7 +122,7 @@ private:
 	U32 *mOutputSize;
 };
 
-class LLKDUMemIn : public kdu_image_in_base
+class LLKDUMemIn : public kdu_supp::kdu_image_in_base
 {
 public:
 	LLKDUMemIn(const U8 *data,
@@ -134,10 +130,10 @@ public:
 				const U16 rows,
 				const U16 cols,
 				U8 in_num_components,
-				siz_params *siz);
+				kdu_core::siz_params *siz);
 	~LLKDUMemIn();
 
-	bool get(int comp_idx, kdu_line_buf &line, int x_tnum);
+	bool get(int comp_idx, kdu_core::kdu_line_buf &line, int x_tnum);
 
 private:
 	const U8 *mData;
@@ -146,8 +142,8 @@ private:
 	int rows, cols;
 	int alignment_bytes; // Number of 0's at end of each line.
 	int precision[3];
-	image_line_buf *incomplete_lines; // Each "sample" represents a full pixel
-	image_line_buf *free_lines;
+	kd_supp_image_local::image_line_buf *incomplete_lines; // Each "sample" represents a full pixel
+	kd_supp_image_local::image_line_buf *free_lines;
 	int num_unread_rows;
 
 	U32 mCurPos;
diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp
index 0605fad068..056c55933a 100755
--- a/indra/llkdu/tests/llimagej2ckdu_test.cpp
+++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp
@@ -29,15 +29,7 @@
 // Class to test 
 #include "llimagej2ckdu.h"
 
-#if LL_DARWIN
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunused-private-field"
 #include "llkdumem.h"
-#pragma clang diagnostic pop
-#else
-#include "llkdumem.h"
-#endif
-
 #include "kdu_block_coding.h"
 // Tut header
 #include "lltut.h"
@@ -113,17 +105,19 @@ void LLImageJ2C::setLastError(const std::string&, const std::string&) { }
 BOOL LLImageJ2C::updateData() { return FALSE; }
 void LLImageJ2C::updateRawDiscardLevel() { }
 
-LLKDUMemIn::LLKDUMemIn(const U8*, const U32, const U16, const U16, const U8, siz_params*) { }
+LLKDUMemIn::LLKDUMemIn(const U8*, const U32, const U16, const U16, const U8, kdu_core::siz_params*) { }
 LLKDUMemIn::~LLKDUMemIn() { }
-bool LLKDUMemIn::get(int, kdu_line_buf&, int) { return false; }
+bool LLKDUMemIn::get(int, kdu_core::kdu_line_buf&, int) { return false; }
 
 // Stub Kakadu Library calls
+// they're all namespaced now
+namespace kdu_core {
 kdu_tile_comp kdu_tile::access_component(int ) { kdu_tile_comp a; return a; }
 kdu_block_encoder::kdu_block_encoder() { }
 kdu_block_decoder::kdu_block_decoder() { }
 void kdu_block::set_max_passes(int , bool ) { }
 void kdu_block::set_max_bytes(int , bool ) { }
-void kdu_tile::close(kdu_thread_env* ) { }
+void kdu_tile::close(kdu_thread_env *, bool) {}
 int kdu_tile::get_num_components() { return 0; }
 bool kdu_tile::get_ycc() { return false; }
 void kdu_tile::set_components_of_interest(int , const int* ) { }
@@ -156,14 +150,14 @@ void kdu_codestream::set_fussy() { }
 void kdu_codestream::get_dims(int, kdu_dims&, bool ) { }
 int kdu_codestream::get_min_dwt_levels() { return 5; }
 int kdu_codestream::get_max_tile_layers() { return 1; }
-void kdu_codestream::change_appearance(bool, bool, bool) { }
+void kdu_codestream::change_appearance(bool, bool, bool, kdu_thread_env *) {}
 void kdu_codestream::get_tile_dims(kdu_coords, int, kdu_dims&, bool ) { }
 void kdu_codestream::destroy() { }
 void kdu_codestream::collect_timing_stats(int ) { }
 void kdu_codestream::set_max_bytes(kdu_long, bool, bool ) { }
 void kdu_codestream::get_valid_tiles(kdu_dims& ) { }
 void kdu_codestream::create(kdu_compressed_source*, kdu_thread_env*) { }
-void kdu_codestream::apply_input_restrictions( int, int, int, int, kdu_dims*, kdu_component_access_mode ) { }
+void kdu_codestream::apply_input_restrictions(int, int, int, int, kdu_dims const *, kdu_component_access_mode, kdu_thread_env *, kdu_quality_limiter const *) {}
 void kdu_codestream::get_subsampling(int , kdu_coords&, bool ) { }
 void kdu_codestream::flush(kdu_long *, int, kdu_uint16 *, bool, bool, double, kdu_thread_env*, int) { }
 void kdu_codestream::set_resilient(bool ) { }
@@ -178,13 +172,15 @@ siz_params* kdu_codestream::access_siz() { return NULL; }
 kdu_tile kdu_codestream::open_tile(kdu_coords , kdu_thread_env* ) { kdu_tile a; return a; }
 kdu_codestream_comment kdu_codestream::add_comment() { kdu_codestream_comment a; return a; }
 void kdu_subband::close_block(kdu_block*, kdu_thread_env*) { }
-void kdu_subband::get_valid_blocks(kdu_dims &indices) { }
-kdu_block* kdu_subband::open_block(kdu_coords, int*, kdu_thread_env*) { return NULL; }
+void kdu_subband::get_valid_blocks(kdu_dims &indices) const { }
+kdu_block * kdu_subband::open_block(kdu_coords, int *, kdu_thread_env *, int, bool) { return NULL; }
 bool kdu_codestream_comment::put_text(const char*) { return false; }
 void kdu_customize_warnings(kdu_message*) { }
 void kdu_customize_errors(kdu_message*) { }
-kdu_long kdu_multi_analysis::create(kdu_codestream, kdu_tile, kdu_thread_env*, kdu_thread_queue*, int, kdu_roi_image*, int) { kdu_long a = 0; return a; }
+kdu_long kdu_multi_analysis::create(kdu_codestream, kdu_tile, kdu_thread_env *,kdu_thread_queue *, int, kdu_roi_image *, int, kdu_sample_allocator *, kdu_push_pull_params const *) { return kdu_long(0); }
+void kdu_multi_analysis::destroy(kdu_thread_env *) {}
 siz_params::siz_params() : kdu_params(NULL, false, false, false, false, false) { }
+siz_params::~siz_params() {}
 void siz_params::finalize(bool ) { }
 void siz_params::copy_with_xforms(kdu_params*, int, int, bool, bool, bool) { }
 int siz_params::write_marker_segment(kdu_output*, kdu_params*, int) { return 0; }
@@ -193,10 +189,15 @@ bool siz_params::read_marker_segment(kdu_uint16, int, kdu_byte a[], int) { retur
 
 kdu_decoder::kdu_decoder(kdu_subband , kdu_sample_allocator*, bool , float, int, kdu_thread_env*, kdu_thread_queue*, int) { }
 void kdu_codestream::create(siz_params*, kdu_compressed_target*, kdu_dims*, int, kdu_long, kdu_thread_env* ) { }
+kdu_sample_allocator::~kdu_sample_allocator() {}
+void kdu_sample_allocator::do_finalize(kdu_codestream) {}
 void (*kdu_convert_ycc_to_rgb_rev16)(kdu_int16*,kdu_int16*,kdu_int16*,int);
 void (*kdu_convert_ycc_to_rgb_irrev16)(kdu_int16*,kdu_int16*,kdu_int16*,int);
 void (*kdu_convert_ycc_to_rgb_rev32)(kdu_int32*,kdu_int32*,kdu_int32*,int);
 void (*kdu_convert_ycc_to_rgb_irrev32)(float*,float*,float*,int);
+bool kdu_core_sample_alignment_checker(int, int, int, int, bool, bool) { return false; }
+void kdu_pull_ifc::destroy() {}
+} // namespace kdu_core
 
 // -------------------------------------------------------------------------------------------
 // TUT
-- 
cgit v1.2.3


From 811a0b5726ed965f9f21ace2d3ec97bb95a91311 Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Tue, 26 Apr 2016 12:14:29 -0700
Subject: DRTVWR-418: add preprocessor define to fix linker error introduced in
 v7.8

---
 indra/llkdu/llimagej2ckdu.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'indra')

diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp
index f48e544813..4f93d85529 100755
--- a/indra/llkdu/llimagej2ckdu.cpp
+++ b/indra/llkdu/llimagej2ckdu.cpp
@@ -25,6 +25,12 @@
  */
 
 #include "linden_common.h"
+
+// based on this KDU support group posting:
+// https://groups.yahoo.com/neo/groups/kakadu_jpeg2000/conversations/messages/6691
+// Defining this values seems to fix the linker error that appeared with the 7.8 release
+#define CORESYS_IMPORTS
+
 #include "llimagej2ckdu.h"
 
 #include "lltimer.h"
-- 
cgit v1.2.3


From ec0e3e9f08cc13025b216f1c4576f5c88622043c Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 26 Apr 2016 22:23:18 -0400
Subject: DRTVWR-418: Match KDU_X86_INTRINSICS macro set for KDU package build.

---
 indra/llkdu/CMakeLists.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'indra')

diff --git a/indra/llkdu/CMakeLists.txt b/indra/llkdu/CMakeLists.txt
index b8f8b420c3..cb0e204e91 100755
--- a/indra/llkdu/CMakeLists.txt
+++ b/indra/llkdu/CMakeLists.txt
@@ -40,6 +40,14 @@ set_source_files_properties(${llkdu_HEADER_FILES}
 
 list(APPEND llkdu_SOURCE_FILES ${llkdu_HEADER_FILES})
 
+# Our KDU package is built with KDU_X86_INTRINSICS in its .vcxproj file.
+# Unless that macro is also set for every consumer build, KDU freaks out,
+# spamming the viewer log with alignment FUD.
+set_source_files_properties(${llkdu_SOURCE_FILES}
+                            PROPERTIES
+                            COMPILE_DEFINITIONS
+                            "KDU_X86_INTRINSICS")
+
 if (USE_KDU)
   add_library (llkdu ${llkdu_SOURCE_FILES})
 
-- 
cgit v1.2.3


From 6f6c8fa5ff6619b123f368d9137c11ed679a5349 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 28 Jun 2016 18:27:39 -0400
Subject: DRTVWR-418: Double coroutine stack size for 64-bit builds on the
 advice of NickyD.

---
 indra/llcommon/llcoros.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'indra')

diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp
index d16bf0160b..290abbf45c 100644
--- a/indra/llcommon/llcoros.cpp
+++ b/indra/llcommon/llcoros.cpp
@@ -100,7 +100,11 @@ LLCoros::LLCoros():
     // Previously we used
     // boost::context::guarded_stack_allocator::default_stacksize();
     // empirically this is 64KB on Windows and Linux. Try quadrupling.
+#if WORD_SIZE == 64
+    mStackSize(512*1024)
+#else
     mStackSize(256*1024)
+#endif
 {
     // Register our cleanup() method for "mainloop" ticks
     LLEventPumps::instance().obtain("mainloop").listen(
-- 
cgit v1.2.3


From 0413e40d82cc53c1e8180023db36108557b6f21c Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Thu, 3 Nov 2016 20:48:41 -0400
Subject: DRTVWR-418: Update KDU and llimagej2ckdu* with certain clang fixes.

---
 indra/llkdu/llimagej2ckdu.cpp            | 31 +++++++++++++++++--------------
 indra/llkdu/llimagej2ckdu.h              |  6 ++++--
 indra/llkdu/tests/llimagej2ckdu_test.cpp |  6 ++++++
 3 files changed, 27 insertions(+), 16 deletions(-)

(limited to 'indra')

diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp
index b85e39b452..0540e55e07 100644
--- a/indra/llkdu/llimagej2ckdu.cpp
+++ b/indra/llkdu/llimagej2ckdu.cpp
@@ -37,7 +37,6 @@
 #include "llpointer.h"
 #include "llmath.h"
 #include "llkdumem.h"
-#include "stringize.h"
 
 #define kdu_xxxx "kdu_block_coding.h"
 #include "include_kdu_xxxx.h"
@@ -50,6 +49,18 @@ using namespace kdu_core;
 #include <sstream>
 #include <iomanip>
 
+// stream kdu_dims to std::ostream
+// Turns out this must NOT be in the anonymous namespace!
+// It must also precede #include "stringize.h".
+inline
+std::ostream& operator<<(std::ostream& out, const kdu_dims& dims)
+{
+	return out << "(" << dims.pos.x << "," << dims.pos.y << "),"
+				  "[" << dims.size.x << "x" << dims.size.y << "]";
+}
+
+#include "stringize.h"
+
 namespace {
 // Failure to load an image shouldn't crash the whole viewer.
 struct KDUError: public LLContinueError
@@ -92,15 +103,6 @@ std::string report_kdu_exception(kdu_exception mb)
 }
 } // anonymous namespace
 
-// stream kdu_dims to std::ostream
-// Turns out this must NOT be in the anonymous namespace!
-inline
-std::ostream& operator<<(std::ostream& out, const kdu_dims& dims)
-{
-	return out << "(" << dims.pos.x << "," << dims.pos.y << "),"
-				  "[" << dims.size.x << "x" << dims.size.y << "]";
-}
-
 class kdc_flow_control {
 	
 public:
@@ -356,9 +358,9 @@ void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECod
 			// This method is only called from methods that catch KDUError.
 			// We want to fail the image load, not crash the viewer.
 			LLTHROW(KDUError(STRINGIZE("Component " << idx << " dimensions "
-									 << other_dims
-									 << " do not match component 0 dimensions "
-									 << dims << "!")));
+									   << stringize(other_dims)
+									   << " do not match component 0 dimensions "
+									   << stringize(dims) << "!")));
 		}
 	}
 
@@ -570,7 +572,8 @@ bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco
 					kdu_coords offset = tile_dims.pos - dims.pos;
 					int row_gap = channels*dims.size.x; // inter-row separation
 					kdu_byte *buf = buffer + offset.y*row_gap + offset.x*channels;
-					mDecodeState.reset(new LLKDUDecodeState(tile, buf, row_gap));
+					mDecodeState.reset(new LLKDUDecodeState(tile, buf, row_gap,
+															mCodeStreamp.get()));
 				}
 				// Do the actual processing
 				F32 remaining_time = decode_time - decode_timer.getElapsedTimeF32();
diff --git a/indra/llkdu/llimagej2ckdu.h b/indra/llkdu/llimagej2ckdu.h
index fd9a396722..b57e4cc40e 100644
--- a/indra/llkdu/llimagej2ckdu.h
+++ b/indra/llkdu/llimagej2ckdu.h
@@ -104,10 +104,12 @@ private:
 			}
 		}
 
-		kdu_codestream* operator->() { return &mCodeStream; }
+		// for those few times when you need a raw kdu_codestream*
+		kdu_core::kdu_codestream* get() { return &mCodeStream; }
+		kdu_core::kdu_codestream* operator->() { return &mCodeStream; }
 
 	private:
-		kdu_codestream mCodeStream;
+		kdu_core::kdu_codestream mCodeStream;
 	};
 
 	// Encode variable
diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp
index 1407da3aa2..ae6138d4c6 100644
--- a/indra/llkdu/tests/llimagej2ckdu_test.cpp
+++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp
@@ -29,7 +29,13 @@
 // Class to test 
 #include "llimagej2ckdu.h"
 
+#if LL_DARWIN
+// For this source, it's true that private fields in llkdumem.h are unused.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-private-field"
 #include "llkdumem.h"
+#pragma clang diagnostic pop
+#endif
 #include "kdu_block_coding.h"
 // Tut header
 #include "lltut.h"
-- 
cgit v1.2.3


From 6c7a97286113b1d3335d585d0d7cbc047baae021 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 15 Nov 2016 15:53:24 -0500
Subject: DRTVWR-418: Fold windows64 into windows platform with new autobuild.

autobuild 1.1 now supports expanding $variables within a config file --
support that was explicitly added to address this very problem. So now the
windows platform in autobuild.xml uses $AUTOBUILD_ADDRSIZE,
$AUTOBUILD_WIN_VSPLATFORM and $AUTOBUILD_WIN_CMAKE_GEN, which should handle
most of the deltas between the windows platform and windows64.

This permits removing the windows64 platform definition from autobuild.xml.

The one remaining delta between the windows64 and windows platform definitions
was -DLL_64BIT_BUILD=TRUE. But we can handle that instead by checking
ADDRESS_SIZE. Change all existing references to WORD_SIZE to ADDRESS_SIZE
instead, and set ADDRESS_SIZE to $AUTOBUILD_ADDRSIZE. Change the one existing
LL_64BIT_BUILD reference to test (ADDRESS_SIZE EQUAL 64) instead.
---
 indra/cmake/00-Common.cmake                     | 12 +++++------
 indra/cmake/ConfigurePkgConfig.cmake            |  6 +++---
 indra/cmake/Variables.cmake                     | 28 ++++++++++++-------------
 indra/llcommon/CMakeLists.txt                   |  4 ++--
 indra/llcommon/llcoros.cpp                      |  2 +-
 indra/llplugin/CMakeLists.txt                   |  4 ++--
 indra/media_plugins/base/CMakeLists.txt         |  4 ++--
 indra/media_plugins/cef/CMakeLists.txt          |  4 ++--
 indra/media_plugins/example/CMakeLists.txt      |  4 ++--
 indra/media_plugins/gstreamer010/CMakeLists.txt |  4 ++--
 indra/media_plugins/libvlc/CMakeLists.txt       |  4 ++--
 11 files changed, 38 insertions(+), 38 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 69d00afda3..e270a43006 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -79,7 +79,7 @@ if (WINDOWS)
       )
 
   # Nicky: x64 implies SSE2
-  if( NOT LL_64BIT_BUILD )
+  if( ADDRESS_SIZE EQUAL 64 )
     add_definitions( /arch:SSE2 )
   endif()
      
@@ -178,9 +178,9 @@ if (LINUX)
   add_definitions(-fvisibility=hidden)
   # don't catch SIGCHLD in our base application class for the viewer - some of our 3rd party libs may need their *own* SIGCHLD handler to work.  Sigh!  The viewer doesn't need to catch SIGCHLD anyway.
   add_definitions(-DLL_IGNORE_SIGCHLD)
-  if (WORD_SIZE EQUAL 32)
+  if (ADDRESS_SIZE EQUAL 32)
     add_definitions(-march=pentium4)
-  endif (WORD_SIZE EQUAL 32)
+  endif (ADDRESS_SIZE EQUAL 32)
   add_definitions(-mfpmath=sse)
   #add_definitions(-ftree-vectorize) # THIS CRASHES GCC 3.1-3.2
   if (NOT USESYSTEMLIBS)
@@ -231,13 +231,13 @@ if (LINUX OR DARWIN)
   set(CMAKE_C_FLAGS "${GCC_WARNINGS} ${CMAKE_C_FLAGS}")
   set(CMAKE_CXX_FLAGS "${GCC_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}")
 
-  if (WORD_SIZE EQUAL 32)
+  if (ADDRESS_SIZE EQUAL 32)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
-  elseif (WORD_SIZE EQUAL 64)
+  elseif (ADDRESS_SIZE EQUAL 64)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
-  endif (WORD_SIZE EQUAL 32)
+  endif (ADDRESS_SIZE EQUAL 32)
 endif (LINUX OR DARWIN)
 
 
diff --git a/indra/cmake/ConfigurePkgConfig.cmake b/indra/cmake/ConfigurePkgConfig.cmake
index 82ee3e7a5b..55d865392e 100644
--- a/indra/cmake/ConfigurePkgConfig.cmake
+++ b/indra/cmake/ConfigurePkgConfig.cmake
@@ -6,17 +6,17 @@ SET(DEBUG_PKG_CONFIG "YES")
 IF("$ENV{PKG_CONFIG_LIBDIR}" STREQUAL "")
 
   # Guess at architecture-specific system library paths.
-  if (WORD_SIZE EQUAL 32)
+  if (ADDRESS_SIZE EQUAL 32)
     SET(PKG_CONFIG_NO_MULTI_GUESS /usr/lib32 /usr/lib)
     SET(PKG_CONFIG_NO_MULTI_LOCAL_GUESS /usr/local/lib32 /usr/local/lib)
     SET(PKG_CONFIG_MULTI_GUESS /usr/lib/i386-linux-gnu)
     SET(PKG_CONFIG_MULTI_LOCAL_GUESS /usr/local/lib/i386-linux-gnu)
-  else (WORD_SIZE EQUAL 32)
+  else (ADDRESS_SIZE EQUAL 32)
     SET(PKG_CONFIG_NO_MULTI_GUESS /usr/lib64 /usr/lib)
     SET(PKG_CONFIG_NO_MULTI_LOCAL_GUESS /usr/local/lib64 /usr/local/lib)
     SET(PKG_CONFIG_MULTI_GUESS /usr/local/lib/x86_64-linux-gnu)
     SET(PKG_CONFIG_MULTI_LOCAL_GUESS /usr/local/lib/x86_64-linux-gnu)
-  endif (WORD_SIZE EQUAL 32)
+  endif (ADDRESS_SIZE EQUAL 32)
   
   # Use DPKG architecture, if available.
   IF (${DPKG_ARCH})
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 63e296b556..464b4c402c 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -65,7 +65,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
   set(ARCH i686)
   set(LL_ARCH ${ARCH}_win32)
   set(LL_ARCH_DIR ${ARCH}-win32)
-  set(WORD_SIZE 32)
+  set(ADDRESS_SIZE 32)
 endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
 
 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -73,33 +73,33 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 
   # If someone has specified a word size, use that to determine the
   # architecture.  Otherwise, let the architecture specify the word size.
-  if (WORD_SIZE EQUAL 32)
-    #message(STATUS "WORD_SIZE is 32")
+  if (ADDRESS_SIZE EQUAL 32)
+    #message(STATUS "ADDRESS_SIZE is 32")
     set(ARCH i686)
-  elseif (WORD_SIZE EQUAL 64)
-    #message(STATUS "WORD_SIZE is 64")
+  elseif (ADDRESS_SIZE EQUAL 64)
+    #message(STATUS "ADDRESS_SIZE is 64")
     set(ARCH x86_64)
-  else (WORD_SIZE EQUAL 32)
-    #message(STATUS "WORD_SIZE is UNDEFINED")
+  else (ADDRESS_SIZE EQUAL 32)
+    #message(STATUS "ADDRESS_SIZE is UNDEFINED")
     execute_process(COMMAND uname -m COMMAND sed s/i.86/i686/
                     OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
     if (ARCH STREQUAL x86_64)
       #message(STATUS "ARCH is detected as 64; ARCH is ${ARCH}")
-      set(WORD_SIZE 64)
+      set(ADDRESS_SIZE 64)
     else (ARCH STREQUAL x86_64)
       #message(STATUS "ARCH is detected as 32; ARCH is ${ARCH}")
-      set(WORD_SIZE 32)
+      set(ADDRESS_SIZE 32)
     endif (ARCH STREQUAL x86_64)
-  endif (WORD_SIZE EQUAL 32)
+  endif (ADDRESS_SIZE EQUAL 32)
 
-  if (WORD_SIZE EQUAL 32)
+  if (ADDRESS_SIZE EQUAL 32)
     set(DEB_ARCHITECTURE i386)
     set(FIND_LIBRARY_USE_LIB64_PATHS OFF)
     set(CMAKE_SYSTEM_LIBRARY_PATH /usr/lib32 ${CMAKE_SYSTEM_LIBRARY_PATH})
-  else (WORD_SIZE EQUAL 32)
+  else (ADDRESS_SIZE EQUAL 32)
     set(DEB_ARCHITECTURE amd64)
     set(FIND_LIBRARY_USE_LIB64_PATHS ON)
-  endif (WORD_SIZE EQUAL 32)
+  endif (ADDRESS_SIZE EQUAL 32)
 
   execute_process(COMMAND dpkg-architecture -a${DEB_ARCHITECTURE} -qDEB_HOST_MULTIARCH 
       RESULT_VARIABLE DPKG_RESULT
@@ -151,7 +151,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   set(ARCH ${CMAKE_OSX_ARCHITECTURES})
   set(LL_ARCH ${ARCH}_darwin)
   set(LL_ARCH_DIR universal-darwin)
-  set(WORD_SIZE 32)
+  set(ADDRESS_SIZE 32)
 endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 
 # Default deploy grid
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 493aa5d0f1..b29b2b2ccf 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -245,13 +245,13 @@ list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
 
 if(LLCOMMON_LINK_SHARED)
   add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
-  if(NOT WORD_SIZE EQUAL 32)
+  if(NOT ADDRESS_SIZE EQUAL 32)
     if(WINDOWS)
       add_definitions(/FIXED:NO)
     else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
       add_definitions(-fPIC)
     endif(WINDOWS)
-  endif(NOT WORD_SIZE EQUAL 32)
+  endif(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
     # always generate llcommon.pdb, even for "Release" builds
     set_target_properties(llcommon PROPERTIES LINK_FLAGS "/DEBUG")
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp
index 0d9e19f672..bc72faca5d 100644
--- a/indra/llcommon/llcoros.cpp
+++ b/indra/llcommon/llcoros.cpp
@@ -101,7 +101,7 @@ LLCoros::LLCoros():
     // Previously we used
     // boost::context::guarded_stack_allocator::default_stacksize();
     // empirically this is 64KB on Windows and Linux. Try quadrupling.
-#if WORD_SIZE == 64
+#if ADDRESS_SIZE == 64
     mStackSize(512*1024)
 #else
     mStackSize(256*1024)
diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt
index 84667f1b82..22f3b24dc5 100644
--- a/indra/llplugin/CMakeLists.txt
+++ b/indra/llplugin/CMakeLists.txt
@@ -56,13 +56,13 @@ set(llplugin_HEADER_FILES
 set_source_files_properties(${llplugin_HEADER_FILES}
                             PROPERTIES HEADER_FILE_ONLY TRUE)
 
-if(NOT WORD_SIZE EQUAL 32)
+if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
     add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
-endif(NOT WORD_SIZE EQUAL 32)
+endif(NOT ADDRESS_SIZE EQUAL 32)
 
 list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES})
 
diff --git a/indra/media_plugins/base/CMakeLists.txt b/indra/media_plugins/base/CMakeLists.txt
index 7367b9e5e6..6913235236 100644
--- a/indra/media_plugins/base/CMakeLists.txt
+++ b/indra/media_plugins/base/CMakeLists.txt
@@ -28,13 +28,13 @@ include_directories(SYSTEM
 
 ### media_plugin_base
 
-if(NOT WORD_SIZE EQUAL 32)
+if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
     add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
-endif(NOT WORD_SIZE EQUAL 32)
+endif(NOT ADDRESS_SIZE EQUAL 32)
 
 set(media_plugin_base_SOURCE_FILES
     media_plugin_base.cpp
diff --git a/indra/media_plugins/cef/CMakeLists.txt b/indra/media_plugins/cef/CMakeLists.txt
index db471c7906..f9aada51a9 100644
--- a/indra/media_plugins/cef/CMakeLists.txt
+++ b/indra/media_plugins/cef/CMakeLists.txt
@@ -34,13 +34,13 @@ include_directories(SYSTEM
 
 ### media_plugin_cef
 
-if(NOT WORD_SIZE EQUAL 32)
+if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
     add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
-endif(NOT WORD_SIZE EQUAL 32)
+endif(NOT ADDRESS_SIZE EQUAL 32)
 
 set(media_plugin_cef_SOURCE_FILES
     media_plugin_cef.cpp
diff --git a/indra/media_plugins/example/CMakeLists.txt b/indra/media_plugins/example/CMakeLists.txt
index 171645ef04..d84e40855b 100644
--- a/indra/media_plugins/example/CMakeLists.txt
+++ b/indra/media_plugins/example/CMakeLists.txt
@@ -32,13 +32,13 @@ include_directories(SYSTEM
 
 ### media_plugin_example
 
-if(NOT WORD_SIZE EQUAL 32)
+if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
     add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
-endif(NOT WORD_SIZE EQUAL 32)
+endif(NOT ADDRESS_SIZE EQUAL 32)
 
 set(media_plugin_example_SOURCE_FILES
     media_plugin_example.cpp
diff --git a/indra/media_plugins/gstreamer010/CMakeLists.txt b/indra/media_plugins/gstreamer010/CMakeLists.txt
index 447f6e0689..a10ea19b17 100644
--- a/indra/media_plugins/gstreamer010/CMakeLists.txt
+++ b/indra/media_plugins/gstreamer010/CMakeLists.txt
@@ -33,13 +33,13 @@ include_directories(SYSTEM
 
 ### media_plugin_gstreamer010
 
-if(NOT WORD_SIZE EQUAL 32)
+if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
     add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
-endif(NOT WORD_SIZE EQUAL 32)
+endif(NOT ADDRESS_SIZE EQUAL 32)
 
 set(media_plugin_gstreamer010_SOURCE_FILES
     media_plugin_gstreamer010.cpp
diff --git a/indra/media_plugins/libvlc/CMakeLists.txt b/indra/media_plugins/libvlc/CMakeLists.txt
index 535d29125b..d652a8dcf9 100644
--- a/indra/media_plugins/libvlc/CMakeLists.txt
+++ b/indra/media_plugins/libvlc/CMakeLists.txt
@@ -33,13 +33,13 @@ include_directories(SYSTEM
 
 ### media_plugin_libvlc
 
-if(NOT WORD_SIZE EQUAL 32)
+if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
     add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
-endif(NOT WORD_SIZE EQUAL 32)
+endif(NOT ADDRESS_SIZE EQUAL 32)
 
 set(media_plugin_libvlc_SOURCE_FILES
     media_plugin_libvlc.cpp
-- 
cgit v1.2.3


From 0c8556921d05a356afd4014b966ee8c0e1002e36 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 15 Nov 2016 16:02:39 -0500
Subject: DRTVWR-418: Mistakenly inverted the sense of the LL_64BIT_BUILD test.

---
 indra/cmake/00-Common.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index e270a43006..8fc05659f6 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -79,7 +79,7 @@ if (WINDOWS)
       )
 
   # Nicky: x64 implies SSE2
-  if( ADDRESS_SIZE EQUAL 64 )
+  if( ADDRESS_SIZE EQUAL 32 )
     add_definitions( /arch:SSE2 )
   endif()
      
-- 
cgit v1.2.3


From 8c061ab184201df3afa4dbe690bb48621ae01ef1 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 16 Nov 2016 15:27:36 -0500
Subject: DRTVWR-418: Compute ADDRESS_SIZE from arch if not specified.

Migrate the logic formerly used only for LINUX to detect whether ADDRESS_SIZE
is set to 32 or 64, and if not, detect a default for the platform. But instead
of using uname -m, use python's platform.machine().

On Windows, stop forcing ARCH to i686 and ADDRESS_SIZE to 32.

On Mac, reset default to x86_64 instead of i386; stop forcing ADDRESS_SIZE to
32.
---
 indra/cmake/Variables.cmake | 60 +++++++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 26 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 464b4c402c..783d76e063 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -60,38 +60,47 @@ if (NOT CMAKE_BUILD_TYPE)
       "Build type.  One of: Debug Release RelWithDebInfo" FORCE)
 endif (NOT CMAKE_BUILD_TYPE)
 
+# If someone has specified an address size, use that to determine the
+# architecture.  Otherwise, let the architecture specify the address size.
+if (ADDRESS_SIZE EQUAL 32)
+  #message(STATUS "ADDRESS_SIZE is 32")
+  set(ARCH i686)
+elseif (ADDRESS_SIZE EQUAL 64)
+  #message(STATUS "ADDRESS_SIZE is 64")
+  set(ARCH x86_64)
+else (ADDRESS_SIZE EQUAL 32)
+  #message(STATUS "ADDRESS_SIZE is UNRECOGNIZED: '${ADDRESS_SIZE}'")
+  # Use Python's platform.machine() since uname -m isn't available everywhere.
+  # Even if you can assume cygwin uname -m, the answer depends on whether
+  # you're running 32-bit cygwin or 64-bit cygwin! But even 32-bit Python will
+  # report a 64-bit processor.
+  execute_process(COMMAND
+                  "${PYTHON_EXECUTABLE}" "-c"
+                  "import platform; print platform.machine()"
+                  OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
+  # We expect values of the form i386, i686, x86_64, AMD64.
+  # In CMake, expressing ARCH.endswith('64') is awkward:
+  string(LENGTH "${ARCH}" ARCH_LENGTH)
+  math(EXPR ARCH_LEN_2 "${ARCH_LENGTH} - 2")
+  string(SUBSTRING "${ARCH}" ${ARCH_LEN_2} 2 ARCH_LAST_2)
+  if (ARCH_LAST_2 STREQUAL 64)
+    #message(STATUS "ARCH is detected as 64; ARCH is ${ARCH}")
+    set(ADDRESS_SIZE 64)
+  else ()
+    #message(STATUS "ARCH is detected as 32; ARCH is ${ARCH}")
+    set(ADDRESS_SIZE 32)
+  endif ()
+endif (ADDRESS_SIZE EQUAL 32)
+
 if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
   set(WINDOWS ON BOOL FORCE)
-  set(ARCH i686)
   set(LL_ARCH ${ARCH}_win32)
   set(LL_ARCH_DIR ${ARCH}-win32)
-  set(ADDRESS_SIZE 32)
 endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
 
 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
   set(LINUX ON BOOl FORCE)
 
-  # If someone has specified a word size, use that to determine the
-  # architecture.  Otherwise, let the architecture specify the word size.
-  if (ADDRESS_SIZE EQUAL 32)
-    #message(STATUS "ADDRESS_SIZE is 32")
-    set(ARCH i686)
-  elseif (ADDRESS_SIZE EQUAL 64)
-    #message(STATUS "ADDRESS_SIZE is 64")
-    set(ARCH x86_64)
-  else (ADDRESS_SIZE EQUAL 32)
-    #message(STATUS "ADDRESS_SIZE is UNDEFINED")
-    execute_process(COMMAND uname -m COMMAND sed s/i.86/i686/
-                    OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
-    if (ARCH STREQUAL x86_64)
-      #message(STATUS "ARCH is detected as 64; ARCH is ${ARCH}")
-      set(ADDRESS_SIZE 64)
-    else (ARCH STREQUAL x86_64)
-      #message(STATUS "ARCH is detected as 32; ARCH is ${ARCH}")
-      set(ADDRESS_SIZE 32)
-    endif (ARCH STREQUAL x86_64)
-  endif (ADDRESS_SIZE EQUAL 32)
-
   if (ADDRESS_SIZE EQUAL 32)
     set(DEB_ARCHITECTURE i386)
     set(FIND_LIBRARY_USE_LIB64_PATHS OFF)
@@ -143,15 +152,14 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
   set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT dwarf-with-dsym)
 
-  # Build only for i386 by default, system default on MacOSX 10.6+ is x86_64
+  # Build only for x86_64 by default
   if (NOT CMAKE_OSX_ARCHITECTURES)
-    set(CMAKE_OSX_ARCHITECTURES "i386")
+    set(CMAKE_OSX_ARCHITECTURES "x86_64")
   endif (NOT CMAKE_OSX_ARCHITECTURES)
 
   set(ARCH ${CMAKE_OSX_ARCHITECTURES})
   set(LL_ARCH ${ARCH}_darwin)
   set(LL_ARCH_DIR universal-darwin)
-  set(ADDRESS_SIZE 32)
 endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 
 # Default deploy grid
-- 
cgit v1.2.3


From d833e45c28a5d3e3605b161a1b6bcf7c06093d25 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 16 Nov 2016 15:32:01 -0500
Subject: DRTVWR-418: Pass ADDRESS_SIZE down into C++ compilation by adding
 -DADDRESS_SIZE= to the compile switches.

Remove hack to work around limitations of gcc 4.1 build hosts.

Streamline a bit of logic to specify correct -m32 or -m64 switch.

Use ADDRESS_SIZE instead of ARCH to control -march=pentiumpro.
---
 indra/cmake/00-Common.cmake | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 4f335b50ec..ec30db685d 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -2,16 +2,28 @@
 #
 # Compilation options shared by all Second Life components.
 
+#*****************************************************************************
+#   It's important to realize that CMake implicitly concatenates
+#   CMAKE_CXX_FLAGS with (e.g.) CMAKE_CXX_FLAGS_RELEASE for Release builds. So
+#   set switches in CMAKE_CXX_FLAGS that should affect all builds, but in
+#   CMAKE_CXX_FLAGS_RELEASE or CMAKE_CXX_FLAGS_RELWITHDEBINFO for switches
+#   that should affect only that build variant.
+#
+#   Also realize that CMAKE_CXX_FLAGS may already be partially populated on
+#   entry to this file.
+#*****************************************************************************
+
 if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
 set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
 
 include(Variables)
 
 # Portable compilation flags.
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DADDRESS_SIZE=${ADDRESS_SIZE}")
+
 set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DLL_DEBUG=1")
 set(CMAKE_CXX_FLAGS_RELEASE
     "-DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 -DNDEBUG") 
-
 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO 
     "-DLL_RELEASE=1 -DNDEBUG -DLL_RELEASE_WITH_DEBUG_INFO=1")
 
@@ -138,13 +150,6 @@ if (LINUX)
   # Let's actually get a numerical version of gxx's version
   STRING(REGEX REPLACE ".* ([0-9])\\.([0-9])\\.([0-9]).*" "\\1\\2\\3" CXX_VERSION_NUMBER ${CXX_VERSION})
 
-  # Hacks to work around gcc 4.1 TC build pool machines which can't process pragma warning disables
-  # This is pure rubbish; I wish there was another way.
-  #
-  if(${CXX_VERSION_NUMBER} LESS 420)
-    set(CMAKE_CXX_FLAGS "-Wno-deprecated -Wno-uninitialized -Wno-unused-variable -Wno-unused-function ${CMAKE_CXX_FLAGS}")
-  endif (${CXX_VERSION_NUMBER} LESS 420)
-
   if(${CXX_VERSION_NUMBER} GREATER 459)
     set(CMAKE_CXX_FLAGS "-Wno-deprecated -Wno-unused-but-set-variable -Wno-unused-variable ${CMAKE_CXX_FLAGS}")
   endif (${CXX_VERSION_NUMBER} GREATER 459)
@@ -231,22 +236,17 @@ if (LINUX OR DARWIN)
   set(CMAKE_C_FLAGS "${GCC_WARNINGS} ${CMAKE_C_FLAGS}")
   set(CMAKE_CXX_FLAGS "${GCC_CXX_WARNINGS} ${CMAKE_CXX_FLAGS}")
 
-  if (ADDRESS_SIZE EQUAL 32)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
-  elseif (ADDRESS_SIZE EQUAL 64)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
-  endif (ADDRESS_SIZE EQUAL 32)
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m${ADDRESS_SIZE}")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m${ADDRESS_SIZE}")
 endif (LINUX OR DARWIN)
 
 
 if (USESYSTEMLIBS)
   add_definitions(-DLL_USESYSTEMLIBS=1)
 
-  if (LINUX AND ${ARCH} STREQUAL "i686")
+  if (LINUX AND ADDRESS_SIZE EQUAL 32)
     add_definitions(-march=pentiumpro)
-  endif (LINUX AND ${ARCH} STREQUAL "i686")
+  endif (LINUX AND ADDRESS_SIZE EQUAL 32)
 
 else (USESYSTEMLIBS)
   set(${ARCH}_linux_INCLUDES
-- 
cgit v1.2.3


From f5e983962703b5cb39278048b1c35e712b2b2263 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 16 Nov 2016 15:39:00 -0500
Subject: DRTVWR-418: Replace preprocessor tests for Windows-specific _M_AMD64
 with tests on ADDRESS_SIZE, which is now set on the compiler command line.

---
 indra/llcommon/llpreprocessor.h | 2 +-
 indra/llmath/llmath.h           | 4 ++--
 indra/llmath/llsimdmath.h       | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h
index 7c277c2bed..3698d9db44 100644
--- a/indra/llcommon/llpreprocessor.h
+++ b/indra/llcommon/llpreprocessor.h
@@ -139,7 +139,7 @@
 #pragma warning (disable : 4180)	// qualifier applied to function type has no meaning; ignored
 //#pragma warning( disable : 4284 )	// silly MS warning deep inside their <map> include file
 
-#ifdef _M_AMD64
+#if ADDRESS_SIZE == 64
 // That one is all over the place for x64 builds.
 #pragma warning( disable : 4267 )   // 'var' : conversion from 'size_t' to 'type', possible loss of data)
 #endif
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index b66a3c63d6..92a48df53c 100644
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -153,7 +153,7 @@ inline F64 llabs(const F64 a)
 
 inline S32 lltrunc( F32 f )
 {
-#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined( _M_AMD64 )
+#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && (ADDRESS_SIZE == 32)
 		// Avoids changing the floating point control word.
 		// Add or subtract 0.5 - epsilon and then round
 		const static U32 zpfp[] = { 0xBEFFFFFF, 0x3EFFFFFF };
@@ -179,7 +179,7 @@ inline S32 lltrunc( F64 f )
 
 inline S32 llfloor( F32 f )
 {
-#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined( _M_AMD64 )
+#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && (ADDRESS_SIZE == 32)
 		// Avoids changing the floating point control word.
 		// Accurate (unlike Stereopsis version) for all values between S32_MIN and S32_MAX and slightly faster than Stereopsis version.
 		// Add -(0.5 - epsilon) and then round
diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h
index 9f078ec1ef..54a275633f 100644
--- a/indra/llmath/llsimdmath.h
+++ b/indra/llmath/llsimdmath.h
@@ -31,7 +31,7 @@
 #error "Please include llmath.h before this file."
 #endif
 
-#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 && !_M_AMD64 ) )
+#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 && ADDRESS_SIZE == 32 ) )
 #error SSE2 not enabled. LLVector4a and related class will not compile.
 #endif
 
-- 
cgit v1.2.3


From 0c43e4e856538be40c80174e4d44c75748df5128 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 16 Nov 2016 16:05:16 -0500
Subject: DRTVWR-418: Disable unconditional signing for Mac builds.

There Must Be A Better Way.
---
 indra/cmake/00-Common.cmake | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index ec30db685d..96ff9a645e 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -211,8 +211,9 @@ if (DARWIN)
   # NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered.
   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
   set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
-  set(ENABLE_SIGNING TRUE)
-  set(SIGNING_IDENTITY "Developer ID Application: Linden Research, Inc.")
+## Really?? On developer machines too?
+##set(ENABLE_SIGNING TRUE)
+##set(SIGNING_IDENTITY "Developer ID Application: Linden Research, Inc.")
 endif (DARWIN)
 
 
-- 
cgit v1.2.3


From bc7d8d3a943db0a562b982ddb9cf2c795f547d5e Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 16 Nov 2016 16:06:32 -0500
Subject: DRTVWR-418: Try to make the OSX architecture match computed ARCH
 which in turn depends on ADDRESS_SIZE.

---
 indra/cmake/Variables.cmake | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 783d76e063..74666be9cb 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -152,12 +152,10 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
   set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT dwarf-with-dsym)
 
-  # Build only for x86_64 by default
-  if (NOT CMAKE_OSX_ARCHITECTURES)
-    set(CMAKE_OSX_ARCHITECTURES "x86_64")
-  endif (NOT CMAKE_OSX_ARCHITECTURES)
+  set(CMAKE_OSX_ARCHITECTURES "${ARCH}")
+  string(REPLACE "i686"  "i386"   CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
+  string(REPLACE "AMD64" "x86_64" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
 
-  set(ARCH ${CMAKE_OSX_ARCHITECTURES})
   set(LL_ARCH ${ARCH}_darwin)
   set(LL_ARCH_DIR universal-darwin)
 endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-- 
cgit v1.2.3


From c5770cd1afa5859a68fdebc7712650ec4781ac8b Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Thu, 17 Nov 2016 08:57:11 -0500
Subject: DRTVWR-418: Add warning about changing to libc++ on Mac.

---
 indra/cmake/Variables.cmake | 1 +
 1 file changed, 1 insertion(+)

(limited to 'indra')

diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 74666be9cb..969726e6e1 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -149,6 +149,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   set(CMAKE_XCODE_ATTRIBUTE_GCC_STRICT_ALIASING NO)
   set(CMAKE_XCODE_ATTRIBUTE_GCC_FAST_MATH NO)
   set(CMAKE_XCODE_ATTRIBUTE_CLANG_X86_VECTOR_INSTRUCTIONS ssse3)
+  message(WARNING "Change Variables.cmake to specify libc++ when updating with p64 3p libraries")
   set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
   set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT dwarf-with-dsym)
 
-- 
cgit v1.2.3


From b1185eca82a1c0fff1a885fd5dfea09e5b9c0b3a Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Thu, 17 Nov 2016 08:59:01 -0500
Subject: DRTVWR-418: Fix Windows line endings in include_kdu_xxxx.h

---
 indra/llkdu/include_kdu_xxxx.h | 80 +++++++++++++++++++++---------------------
 1 file changed, 40 insertions(+), 40 deletions(-)

(limited to 'indra')

diff --git a/indra/llkdu/include_kdu_xxxx.h b/indra/llkdu/include_kdu_xxxx.h
index 5e86944994..a1dbced60b 100644
--- a/indra/llkdu/include_kdu_xxxx.h
+++ b/indra/llkdu/include_kdu_xxxx.h
@@ -1,40 +1,40 @@
-/**
- * @file   include_kdu_xxxx.h
- * @author Nat Goodspeed
- * @date   2016-04-25
- * @brief  
- * 
- * $LicenseInfo:firstyear=2016&license=viewerlgpl$
- * Copyright (c) 2016, Linden Research, Inc.
- * $/LicenseInfo$
- */
-
-// This file specifically omits #include guards of its own: it's sort of an
-// #include macro used to wrap KDU #includes with proper incantations. Usage:
-
-// #define kdu_xxxx "kdu_compressed.h" // or whichever KDU header
-// #include "include_kdu_xxxx.h"
-// // kdu_xxxx #undef'ed by include_kdu_xxxx.h
-
-#if LL_DARWIN
-// don't *really* want to rebuild KDU so turn off specific warnings for this header
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wself-assign-field"
-#pragma clang diagnostic ignored "-Wunused-private-field"
-#include kdu_xxxx
-#pragma clang diagnostic pop
-#elif LL_WINDOWS
-// With warnings-as-errors in effect, strange relationship between
-// jp2_output_box and its subclass jp2_target in kdu_compressed.h
-// causes build failures. Specifically:
-// warning C4263: 'void kdu_supp::jp2_target::open(kdu_supp::jp2_family_tgt *)' : member function does not override any base class virtual member function
-// warning C4264: 'void kdu_supp::jp2_output_box::open(kdu_core::kdu_uint32)' : no override available for virtual member function from base 'kdu_supp::jp2_output_box'; function is hidden
-#pragma warning(push)
-#pragma warning(disable : 4263 4264)
-#include kdu_xxxx
-#pragma warning(pop)
-#else // some other platform
-#include kdu_xxxx
-#endif
-
-#undef kdu_xxxx
+/**
+ * @file   include_kdu_xxxx.h
+ * @author Nat Goodspeed
+ * @date   2016-04-25
+ * @brief  
+ * 
+ * $LicenseInfo:firstyear=2016&license=viewerlgpl$
+ * Copyright (c) 2016, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+// This file specifically omits #include guards of its own: it's sort of an
+// #include macro used to wrap KDU #includes with proper incantations. Usage:
+
+// #define kdu_xxxx "kdu_compressed.h" // or whichever KDU header
+// #include "include_kdu_xxxx.h"
+// // kdu_xxxx #undef'ed by include_kdu_xxxx.h
+
+#if LL_DARWIN
+// don't *really* want to rebuild KDU so turn off specific warnings for this header
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wself-assign-field"
+#pragma clang diagnostic ignored "-Wunused-private-field"
+#include kdu_xxxx
+#pragma clang diagnostic pop
+#elif LL_WINDOWS
+// With warnings-as-errors in effect, strange relationship between
+// jp2_output_box and its subclass jp2_target in kdu_compressed.h
+// causes build failures. Specifically:
+// warning C4263: 'void kdu_supp::jp2_target::open(kdu_supp::jp2_family_tgt *)' : member function does not override any base class virtual member function
+// warning C4264: 'void kdu_supp::jp2_output_box::open(kdu_core::kdu_uint32)' : no override available for virtual member function from base 'kdu_supp::jp2_output_box'; function is hidden
+#pragma warning(push)
+#pragma warning(disable : 4263 4264)
+#include kdu_xxxx
+#pragma warning(pop)
+#else // some other platform
+#include kdu_xxxx
+#endif
+
+#undef kdu_xxxx
-- 
cgit v1.2.3


From 73a7b14013059eee3b010ae271515d7492654f9b Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Thu, 17 Nov 2016 17:46:50 -0500
Subject: DRTVWR-418: Fold redundant testrunner.py modules together again.

llcorehttp/tests had a clone of llmessage/tests/testrunner.py that was almost
identical save for recognizing an extra optional parameter. Migrate those few
lines into llmessage/tests/testrunner.py; eliminate the copy in llcorehttp;
help test_llcorehttp_peer.py find the testrunner.py in llmessage/tests.
---
 indra/llcorehttp/tests/test_llcorehttp_peer.py |   5 +
 indra/llcorehttp/tests/testrunner.py           | 265 -------------------------
 indra/llmessage/tests/testrunner.py            |   5 +-
 3 files changed, 9 insertions(+), 266 deletions(-)
 delete mode 100755 indra/llcorehttp/tests/testrunner.py

(limited to 'indra')

diff --git a/indra/llcorehttp/tests/test_llcorehttp_peer.py b/indra/llcorehttp/tests/test_llcorehttp_peer.py
index 6c5f37d407..3ec9cd7d4c 100755
--- a/indra/llcorehttp/tests/test_llcorehttp_peer.py
+++ b/indra/llcorehttp/tests/test_llcorehttp_peer.py
@@ -44,6 +44,11 @@ from SocketServer import ThreadingMixIn
 
 from llbase.fastest_elementtree import parse as xml_parse
 from llbase import llsd
+
+# we're in llcorehttp/tests ; testrunner.py is found in llmessage/tests
+sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
+                             "llmessage", "tests"))
+
 from testrunner import freeport, run, debug, VERBOSE
 
 class TestHTTPRequestHandler(BaseHTTPRequestHandler):
diff --git a/indra/llcorehttp/tests/testrunner.py b/indra/llcorehttp/tests/testrunner.py
deleted file mode 100755
index 9a2de71142..0000000000
--- a/indra/llcorehttp/tests/testrunner.py
+++ /dev/null
@@ -1,265 +0,0 @@
-#!/usr/bin/env python
-"""\
-@file   testrunner.py
-@author Nat Goodspeed
-@date   2009-03-20
-@brief  Utilities for writing wrapper scripts for ADD_COMM_BUILD_TEST unit tests
-
-$LicenseInfo:firstyear=2009&license=viewerlgpl$
-Second Life Viewer Source Code
-Copyright (C) 2010, Linden Research, Inc.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation;
-version 2.1 of the License only.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
-$/LicenseInfo$
-"""
-
-from __future__ import with_statement
-
-import os
-import sys
-import re
-import errno
-import socket
-
-VERBOSE = os.environ.get("INTEGRATION_TEST_VERBOSE", "0") # default to quiet
-# Support usage such as INTEGRATION_TEST_VERBOSE=off -- distressing to user if
-# that construct actually turns on verbosity...
-VERBOSE = not re.match(r"(0|off|false|quiet)$", VERBOSE, re.IGNORECASE)
-
-if VERBOSE:
-    def debug(fmt, *args):
-        print fmt % args
-        sys.stdout.flush()
-else:
-    debug = lambda *args: None
-
-def freeport(portlist, expr):
-    """
-    Find a free server port to use. Specifically, evaluate 'expr' (a
-    callable(port)) until it stops raising EADDRINUSE exception.
-
-    Pass:
-
-    portlist: an iterable (e.g. xrange()) of ports to try. If you exhaust the
-    range, freeport() lets the socket.error exception propagate. If you want
-    unbounded, you could pass itertools.count(baseport), though of course in
-    practice the ceiling is 2^16-1 anyway. But it seems prudent to constrain
-    the range much more sharply: if we're iterating an absurd number of times,
-    probably something else is wrong.
-
-    expr: a callable accepting a port number, specifically one of the items
-    from portlist. If calling that callable raises socket.error with
-    EADDRINUSE, freeport() retrieves the next item from portlist and retries.
-
-    Returns: (expr(port), port)
-
-    port: the value from portlist for which expr(port) succeeded
-
-    Raises:
-
-    Any exception raised by expr(port) other than EADDRINUSE.
-
-    socket.error if, for every item from portlist, expr(port) raises
-    socket.error. The exception you see is the one from the last item in
-    portlist.
-
-    StopIteration if portlist is completely empty.
-
-    Example:
-
-    class Server(HTTPServer):
-        # If you use BaseHTTPServer.HTTPServer, turning off this flag is
-        # essential for proper operation of freeport()!
-        allow_reuse_address = False
-    # ...
-    server, port = freeport(xrange(8000, 8010),
-                            lambda port: Server(("localhost", port),
-                                                MyRequestHandler))
-    # pass 'port' to client code
-    # call server.serve_forever()
-    """
-    try:
-        # If portlist is completely empty, let StopIteration propagate: that's an
-        # error because we can't return meaningful values. We have no 'port',
-        # therefore no 'expr(port)'.
-        portiter = iter(portlist)
-        port = portiter.next()
-
-        while True:
-            try:
-                # If this value of port works, return as promised.
-                value = expr(port)
-
-            except socket.error, err:
-                # Anything other than 'Address already in use', propagate
-                if err.args[0] != errno.EADDRINUSE:
-                    raise
-
-                # Here we want the next port from portiter. But on StopIteration,
-                # we want to raise the original exception rather than
-                # StopIteration. So save the original exc_info().
-                type, value, tb = sys.exc_info()
-                try:
-                    try:
-                        port = portiter.next()
-                    except StopIteration:
-                        raise type, value, tb
-                finally:
-                    # Clean up local traceback, see docs for sys.exc_info()
-                    del tb
-
-            else:
-                debug("freeport() returning %s on port %s", value, port)
-                return value, port
-
-            # Recap of the control flow above:
-            # If expr(port) doesn't raise, return as promised.
-            # If expr(port) raises anything but EADDRINUSE, propagate that
-            # exception.
-            # If portiter.next() raises StopIteration -- that is, if the port
-            # value we just passed to expr(port) was the last available -- reraise
-            # the EADDRINUSE exception.
-            # If we've actually arrived at this point, portiter.next() delivered a
-            # new port value. Loop back to pass that to expr(port).
-
-    except Exception, err:
-        debug("*** freeport() raising %s: %s", err.__class__.__name__, err)
-        raise
-
-def run(*args, **kwds):
-    """All positional arguments collectively form a command line, executed as
-    a synchronous child process.
-    In addition, pass server=new_thread_instance as an explicit keyword (to
-    differentiate it from an additional command-line argument).
-    new_thread_instance should be an instantiated but not yet started Thread
-    subclass instance, e.g.:
-    run("python", "-c", 'print "Hello, world!"', server=TestHTTPServer(name="httpd"))
-    """
-    # If there's no server= keyword arg, don't start a server thread: simply
-    # run a child process.
-    try:
-        thread = kwds.pop("server")
-    except KeyError:
-        pass
-    else:
-        # Start server thread. Note that this and all other comm server
-        # threads should be daemon threads: we'll let them run "forever,"
-        # confident that the whole process will terminate when the main thread
-        # terminates, which will be when the child process terminates.
-        thread.setDaemon(True)
-        thread.start()
-    # choice of os.spawnv():
-    # - [v vs. l] pass a list of args vs. individual arguments,
-    # - [no p] don't use the PATH because we specifically want to invoke the
-    #   executable passed as our first arg,
-    # - [no e] child should inherit this process's environment.
-    debug("Running %s...", " ".join(args))
-    if kwds.get("use_path", False):
-        rc = os.spawnvp(os.P_WAIT, args[0], args)
-    else:
-        rc = os.spawnv(os.P_WAIT, args[0], args)
-    debug("%s returned %s", args[0], rc)
-    return rc
-
-# ****************************************************************************
-#   test code -- manual at this point, see SWAT-564
-# ****************************************************************************
-def test_freeport():
-    # ------------------------------- Helpers --------------------------------
-    from contextlib import contextmanager
-    # helper Context Manager for expecting an exception
-    # with exc(SomeError):
-    #     raise SomeError()
-    # raises AssertionError otherwise.
-    @contextmanager
-    def exc(exception_class, *args):
-        try:
-            yield
-        except exception_class, err:
-            for i, expected_arg in enumerate(args):
-                assert expected_arg == err.args[i], \
-                       "Raised %s, but args[%s] is %r instead of %r" % \
-                       (err.__class__.__name__, i, err.args[i], expected_arg)
-            print "Caught expected exception %s(%s)" % \
-                  (err.__class__.__name__, ', '.join(repr(arg) for arg in err.args))
-        else:
-            assert False, "Failed to raise " + exception_class.__class__.__name__
-
-    # helper to raise specified exception
-    def raiser(exception):
-        raise exception
-
-    # the usual
-    def assert_equals(a, b):
-        assert a == b, "%r != %r" % (a, b)
-
-    # ------------------------ Sanity check the above ------------------------
-    class SomeError(Exception): pass
-    # Without extra args, accept any err.args value
-    with exc(SomeError):
-        raiser(SomeError("abc"))
-    # With extra args, accept only the specified value
-    with exc(SomeError, "abc"):
-        raiser(SomeError("abc"))
-    with exc(AssertionError):
-        with exc(SomeError, "abc"):
-            raiser(SomeError("def"))
-    with exc(AssertionError):
-        with exc(socket.error, errno.EADDRINUSE):
-            raiser(socket.error(errno.ECONNREFUSED, 'Connection refused'))
-
-    # ----------- freeport() without engaging socket functionality -----------
-    # If portlist is empty, freeport() raises StopIteration.
-    with exc(StopIteration):
-        freeport([], None)
-
-    assert_equals(freeport([17], str), ("17", 17))
-
-    # This is the magic exception that should prompt us to retry
-    inuse = socket.error(errno.EADDRINUSE, 'Address already in use')
-    # Get the iterator to our ports list so we can check later if we've used all
-    ports = iter(xrange(5))
-    with exc(socket.error, errno.EADDRINUSE):
-        freeport(ports, lambda port: raiser(inuse))
-    # did we entirely exhaust 'ports'?
-    with exc(StopIteration):
-        ports.next()
-
-    ports = iter(xrange(2))
-    # Any exception but EADDRINUSE should quit immediately
-    with exc(SomeError):
-        freeport(ports, lambda port: raiser(SomeError()))
-    assert_equals(ports.next(), 1)
-
-    # ----------- freeport() with platform-dependent socket stuff ------------
-    # This is what we should've had unit tests to begin with (see CHOP-661).
-    def newbind(port):
-        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        sock.bind(('127.0.0.1', port))
-        return sock
-
-    bound0, port0 = freeport(xrange(7777, 7780), newbind)
-    assert_equals(port0, 7777)
-    bound1, port1 = freeport(xrange(7777, 7780), newbind)
-    assert_equals(port1, 7778)
-    bound2, port2 = freeport(xrange(7777, 7780), newbind)
-    assert_equals(port2, 7779)
-    with exc(socket.error, errno.EADDRINUSE):
-        bound3, port3 = freeport(xrange(7777, 7780), newbind)
-
-if __name__ == "__main__":
-    test_freeport()
diff --git a/indra/llmessage/tests/testrunner.py b/indra/llmessage/tests/testrunner.py
index 5b9beb359b..9a2de71142 100755
--- a/indra/llmessage/tests/testrunner.py
+++ b/indra/llmessage/tests/testrunner.py
@@ -168,7 +168,10 @@ def run(*args, **kwds):
     #   executable passed as our first arg,
     # - [no e] child should inherit this process's environment.
     debug("Running %s...", " ".join(args))
-    rc = os.spawnv(os.P_WAIT, args[0], args)
+    if kwds.get("use_path", False):
+        rc = os.spawnvp(os.P_WAIT, args[0], args)
+    else:
+        rc = os.spawnv(os.P_WAIT, args[0], args)
     debug("%s returned %s", args[0], rc)
     return rc
 
-- 
cgit v1.2.3


From 92d7eaaf07f3b764a9c626c148a2a5652df590ad Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Thu, 17 Nov 2016 17:50:55 -0500
Subject: DRTVWR-418: Provide Darwin_i686_Manifest alias to
 Darwin_i386_Manifest.

It's never been clear to me why Macs tend to refer to 32-bit Intel processors
as i386 when other platforms tend to refer to them as i686. New CMake logic to
derive ARCH from ADDRESS_SIZE produces i686. Give viewer_manifest.py a
Darwin_i686_Manifest class alias so it continues to work when arch is passed
as i686 as well as i386.
---
 indra/newview/viewer_manifest.py | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 29751edfac..1b6e8c9747 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -1049,6 +1049,10 @@ class Darwin_i386_Manifest(ViewerManifest):
         self.package_file = finalname
         self.remove(sparsename)
 
+class Darwin_i686_Manifest(Darwin_i386_Manifest):
+    """alias in case arch is passed as i686 instead of i386"""
+    pass
+
 class LinuxManifest(ViewerManifest):
     def construct(self):
         super(LinuxManifest, self).construct()
-- 
cgit v1.2.3


From 8b61d4f2770e44cc74997c98491edc0107c8527a Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Sat, 19 Nov 2016 08:51:29 -0500
Subject: DRTVWR-418: Change to libc++ on Mac, remove reminder warning.

---
 indra/cmake/Variables.cmake | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 969726e6e1..3d0cb0a3c9 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -149,8 +149,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   set(CMAKE_XCODE_ATTRIBUTE_GCC_STRICT_ALIASING NO)
   set(CMAKE_XCODE_ATTRIBUTE_GCC_FAST_MATH NO)
   set(CMAKE_XCODE_ATTRIBUTE_CLANG_X86_VECTOR_INSTRUCTIONS ssse3)
-  message(WARNING "Change Variables.cmake to specify libc++ when updating with p64 3p libraries")
-  set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
+  set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
   set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT dwarf-with-dsym)
 
   set(CMAKE_OSX_ARCHITECTURES "${ARCH}")
-- 
cgit v1.2.3


From 40f7501319087291c8b9881095b4b35f0dcf0554 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 22 Nov 2016 08:35:41 -0500
Subject: DRTVWR-418: Use uintptr_t when casting pointers to ints.

LLPrivateMemoryPool and LLPrivateMemoryPoolManager have assumed that it's
always valid to cast a pointer to U32. With 64-bit pointers, no longer true.
---
 indra/llcommon/llmemory.cpp | 24 ++++++++++++------------
 indra/llcommon/llmemory.h   |  4 ++--
 2 files changed, 14 insertions(+), 14 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index 3a8eabac09..1e04044269 100644
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -591,7 +591,7 @@ char* LLPrivateMemoryPool::LLMemoryBlock::allocate()
 void  LLPrivateMemoryPool::LLMemoryBlock::freeMem(void* addr) 
 {
 	//bit index
-	U32 idx = ((U32)addr - (U32)mBuffer - mDummySize) / mSlotSize ;
+	uintptr_t idx = ((uintptr_t)addr - (uintptr_t)mBuffer - mDummySize) / mSlotSize ;
 
 	U32* bits = &mUsageBits ;
 	if(idx >= 32)
@@ -773,7 +773,7 @@ char* LLPrivateMemoryPool::LLMemoryChunk::allocate(U32 size)
 
 void LLPrivateMemoryPool::LLMemoryChunk::freeMem(void* addr)
 {	
-	U32 blk_idx = getPageIndex((U32)addr) ;
+	U32 blk_idx = getPageIndex((uintptr_t)addr) ;
 	LLMemoryBlock* blk = (LLMemoryBlock*)(mMetaBuffer + blk_idx * sizeof(LLMemoryBlock)) ;
 	blk = blk->mSelf ;
 
@@ -798,7 +798,7 @@ bool LLPrivateMemoryPool::LLMemoryChunk::empty()
 
 bool LLPrivateMemoryPool::LLMemoryChunk::containsAddress(const char* addr) const
 {
-	return (U32)mBuffer <= (U32)addr && (U32)mBuffer + mBufferSize > (U32)addr ;
+	return (uintptr_t)mBuffer <= (uintptr_t)addr && (uintptr_t)mBuffer + mBufferSize > (uintptr_t)addr ;
 }
 
 //debug use
@@ -831,13 +831,13 @@ void LLPrivateMemoryPool::LLMemoryChunk::dump()
 	for(U32 i = 1 ; i < blk_list.size(); i++)
 	{
 		total_size += blk_list[i]->getBufferSize() ;
-		if((U32)blk_list[i]->getBuffer() < (U32)blk_list[i-1]->getBuffer() + blk_list[i-1]->getBufferSize())
+		if((uintptr_t)blk_list[i]->getBuffer() < (uintptr_t)blk_list[i-1]->getBuffer() + blk_list[i-1]->getBufferSize())
 		{
 			LL_ERRS() << "buffer corrupted." << LL_ENDL ;
 		}
 	}
 
-	llassert_always(total_size + mMinBlockSize >= mBufferSize - ((U32)mDataBuffer - (U32)mBuffer)) ;
+	llassert_always(total_size + mMinBlockSize >= mBufferSize - ((uintptr_t)mDataBuffer - (uintptr_t)mBuffer)) ;
 
 	U32 blk_num = (mBufferSize - (mDataBuffer - mBuffer)) / mMinBlockSize ;
 	for(U32 i = 0 ; i < blk_num ; )
@@ -860,7 +860,7 @@ void LLPrivateMemoryPool::LLMemoryChunk::dump()
 #endif
 #if 0
 	LL_INFOS() << "---------------------------" << LL_ENDL ;
-	LL_INFOS() << "Chunk buffer: " << (U32)getBuffer() << " size: " << getBufferSize() << LL_ENDL ;
+	LL_INFOS() << "Chunk buffer: " << (uintptr_t)getBuffer() << " size: " << getBufferSize() << LL_ENDL ;
 
 	LL_INFOS() << "available blocks ... " << LL_ENDL ;
 	for(S32 i = 0 ; i < mBlockLevels ; i++)
@@ -868,7 +868,7 @@ void LLPrivateMemoryPool::LLMemoryChunk::dump()
 		LLMemoryBlock* blk = mAvailBlockList[i] ;
 		while(blk)
 		{
-			LL_INFOS() << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << LL_ENDL ;
+			LL_INFOS() << "blk buffer " << (uintptr_t)blk->getBuffer() << " size: " << blk->getBufferSize() << LL_ENDL ;
 			blk = blk->mNext ;
 		}
 	}
@@ -879,7 +879,7 @@ void LLPrivateMemoryPool::LLMemoryChunk::dump()
 		LLMemoryBlock* blk = mFreeSpaceList[i] ;
 		while(blk)
 		{
-			LL_INFOS() << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << LL_ENDL ;
+			LL_INFOS() << "blk buffer " << (uintptr_t)blk->getBuffer() << " size: " << blk->getBufferSize() << LL_ENDL ;
 			blk = blk->mNext ;
 		}
 	}
@@ -1155,9 +1155,9 @@ void LLPrivateMemoryPool::LLMemoryChunk::addToAvailBlockList(LLMemoryBlock* blk)
 	return ;
 }
 
-U32 LLPrivateMemoryPool::LLMemoryChunk::getPageIndex(U32 addr)
+U32 LLPrivateMemoryPool::LLMemoryChunk::getPageIndex(uintptr_t addr)
 {
-	return (addr - (U32)mDataBuffer) / mMinBlockSize ;
+	return (addr - (uintptr_t)mDataBuffer) / mMinBlockSize ;
 }
 
 //for mAvailBlockList
@@ -1495,7 +1495,7 @@ void LLPrivateMemoryPool::removeChunk(LLMemoryChunk* chunk)
 
 U16 LLPrivateMemoryPool::findHashKey(const char* addr)
 {
-	return (((U32)addr) / CHUNK_SIZE) % mHashFactor ;
+	return (((uintptr_t)addr) / CHUNK_SIZE) % mHashFactor ;
 }
 
 LLPrivateMemoryPool::LLMemoryChunk* LLPrivateMemoryPool::findChunk(const char* addr)
@@ -1720,7 +1720,7 @@ LLPrivateMemoryPoolManager::~LLPrivateMemoryPoolManager()
 		S32 k = 0 ;
 		for(mem_allocation_info_t::iterator iter = sMemAllocationTracker.begin() ; iter != sMemAllocationTracker.end() ; ++iter)
 		{
-			LL_INFOS() << k++ << ", " << (U32)iter->first << " : " << iter->second << LL_ENDL ;
+			LL_INFOS() << k++ << ", " << (uintptr_t)iter->first << " : " << iter->second << LL_ENDL ;
 		}
 		sMemAllocationTracker.clear() ;
 	}
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 98e08cdc55..5a3c9bd762 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -415,7 +415,7 @@ public:
 		{
 			bool operator()(const LLMemoryBlock* const& lhs, const LLMemoryBlock* const& rhs)
 			{
-				return (U32)lhs->getBuffer() < (U32)rhs->getBuffer();
+				return (uintptr_t)lhs->getBuffer() < (uintptr_t)rhs->getBuffer();
 			}
 		};
 	};
@@ -446,7 +446,7 @@ public:
 		void dump() ;
 
 	private:
-		U32 getPageIndex(U32 addr) ;
+		U32 getPageIndex(uintptr_t addr) ;
 		U32 getBlockLevel(U32 size) ;
 		U16 getPageLevel(U32 size) ;
 		LLMemoryBlock* addBlock(U32 blk_idx) ;
-- 
cgit v1.2.3


From 9c55b368566ad1874d845573c4df66dc77766d29 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 22 Nov 2016 08:37:45 -0500
Subject: DRTVWR-418: Update comments to reflect status of P0091R3.

Some day llmake() will be unnecessary because compiler deduction of class
template arguments from constructor arguments has been approved by ISO.
---
 indra/llcommon/llmake.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llmake.h b/indra/llcommon/llmake.h
index 9a662a0640..08744f90fb 100644
--- a/indra/llcommon/llmake.h
+++ b/indra/llcommon/llmake.h
@@ -12,12 +12,10 @@
  * 
  *         also relevant:
  *
- *         Template parameter deduction for constructors
- *         http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0091r0.html
- *
- *         https://github.com/viboes/std-make
- *
- *         but obviously we're not there yet.
+ *         Template argument deduction for class templates
+ *         http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0091r3.html
+ *         was apparently adopted in June 2016? Unclear when compilers will
+ *         portably support this, but there is hope.
  *
  * $LicenseInfo:firstyear=2015&license=viewerlgpl$
  * Copyright (c) 2015, Linden Research, Inc.
-- 
cgit v1.2.3


From e7324c8956e0785645f42f739c221ed7167ad6f0 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 22 Nov 2016 08:39:31 -0500
Subject: DRTVWR-418: Use correct spelling for glh_linear package.

---
 indra/cmake/GLEXT.cmake | 2 +-
 indra/cmake/GLH.cmake   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/GLEXT.cmake b/indra/cmake/GLEXT.cmake
index 2a08c8fbae..9fd3923bfd 100644
--- a/indra/cmake/GLEXT.cmake
+++ b/indra/cmake/GLEXT.cmake
@@ -5,6 +5,6 @@ if (NOT USESYSTEMLIBS)
   if (WINDOWS OR LINUX)
     use_prebuilt_binary(glext)
   endif (WINDOWS OR LINUX)
-  use_prebuilt_binary(glh-linear)
+  use_prebuilt_binary(glh_linear)
   set(GLEXT_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
 endif (NOT USESYSTEMLIBS)
diff --git a/indra/cmake/GLH.cmake b/indra/cmake/GLH.cmake
index d0992f57b8..d5262f2efa 100644
--- a/indra/cmake/GLH.cmake
+++ b/indra/cmake/GLH.cmake
@@ -7,5 +7,5 @@ set(GLH_FIND_QUIETLY TRUE)
 if (USESYSTEMLIBS)
   include(FindGLH)
 else (USESYSTEMLIBS)
-  use_prebuilt_binary(glh-linear)
+  use_prebuilt_binary(glh_linear)
 endif (USESYSTEMLIBS)
-- 
cgit v1.2.3


From 548f59042f116c04dd3d34d66b0328801eb2286f Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 22 Nov 2016 08:40:41 -0500
Subject: DRTVWR-418: libc++ has stat data in <sys/types.h>.

---
 indra/llcommon/llfile.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h
index 3e25228aeb..315e18e4f2 100644
--- a/indra/llcommon/llfile.h
+++ b/indra/llcommon/llfile.h
@@ -45,7 +45,7 @@ typedef FILE	LLFILE;
 typedef struct _stat	llstat;
 #else
 typedef struct stat		llstat;
-#include <bits/postypes.h>
+#include <sys/types.h>
 #endif
 
 #ifndef S_ISREG
-- 
cgit v1.2.3


From b9cc216b9cbded6f4adbc67f58d0fbc464ee0c9f Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 23 Nov 2016 12:07:31 -0500
Subject: DRTVWR-418: Have to #include "llkdumem.h" even when not LL_DARWIN.

---
 indra/llkdu/tests/llimagej2ckdu_test.cpp | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'indra')

diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp
index ae6138d4c6..e386a9f71b 100644
--- a/indra/llkdu/tests/llimagej2ckdu_test.cpp
+++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp
@@ -35,6 +35,8 @@
 #pragma clang diagnostic ignored "-Wunused-private-field"
 #include "llkdumem.h"
 #pragma clang diagnostic pop
+#else
+#include "llkdumem.h"
 #endif
 #include "kdu_block_coding.h"
 // Tut header
-- 
cgit v1.2.3


From fc4564c415a45001cf2e35776df2be2196af26e0 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 23 Nov 2016 12:08:53 -0500
Subject: DRTVWR-418: Work around missing LLCEFLibSettings::page_zoom_factor.

---
 indra/media_plugins/cef/media_plugin_cef.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp
index 4eb29c98f9..d04bc16d4f 100644
--- a/indra/media_plugins/cef/media_plugin_cef.cpp
+++ b/indra/media_plugins/cef/media_plugin_cef.cpp
@@ -501,7 +501,10 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
 				LLCEFLib::LLCEFLibSettings settings;
 				settings.initial_width = 1024;
 				settings.initial_height = 1024;
-				settings.page_zoom_factor = message_in.getValueReal("factor");
+				// The LLCEFLibSettings struct in the Windows 32-bit
+				// llceflib's build 500907 does not have a page_zoom_factor
+				// member. Set below.
+				//settings.page_zoom_factor = message_in.getValueReal("factor");
 				settings.plugins_enabled = mPluginsEnabled;
 				settings.media_stream_enabled = false; // MAINT-6060 - WebRTC media removed until we can add granualrity/query UI
 				settings.javascript_enabled = mJavascriptEnabled;
@@ -518,6 +521,9 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
 					// if this fails, the media system in viewer will put up a message
 				}
 
+				// now we can set page zoom factor
+				mLLCEFLib->setPageZoom(message_in.getValueReal("factor"));
+
 				// Plugin gets to decide the texture parameters to use.
 				mDepth = 4;
 				LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "texture_params");
-- 
cgit v1.2.3


From 6979fc56679d4a86451e46d511b133ac02152184 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Mon, 28 Nov 2016 15:45:58 -0500
Subject: DRTVWR-418: Revert one more openjp2.dll reference to openjpeg.dll.

---
 indra/cmake/Copy3rdPartyLibs.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake
index 4c1fb087e7..5b59666796 100644
--- a/indra/cmake/Copy3rdPartyLibs.cmake
+++ b/indra/cmake/Copy3rdPartyLibs.cmake
@@ -43,7 +43,7 @@ if(WINDOWS)
 
     set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
     set(release_files
-        openjp2.dll
+        openjpeg.dll
         libapr-1.dll
         libaprutil-1.dll
         libapriconv-1.dll
-- 
cgit v1.2.3


From 05fb9468d06e58d4973ec1c3859afa4b3dcad69a Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 29 Nov 2016 21:18:58 -0500
Subject: DRTVWR-418: Address yet another effect of downdating openjpeg.

---
 indra/llimagej2coj/llimagej2coj.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'indra')

diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp
index 3bb1778d9d..925da5674b 100644
--- a/indra/llimagej2coj/llimagej2coj.cpp
+++ b/indra/llimagej2coj/llimagej2coj.cpp
@@ -41,8 +41,12 @@ LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl()
 
 std::string LLImageJ2COJ::getEngineInfo() const
 {
+#ifdef OPENJPEG_VERSION
 	return std::string("OpenJPEG: " OPENJPEG_VERSION ", Runtime: ")
 		+ opj_version();
+#else
+	return std::string("OpenJPEG runtime: ") + opj_version();
+#endif
 }
 
 // Return string from message, eliminating final \n if present
-- 
cgit v1.2.3


From e61320921a92a367c67aea7ecba0078e8e36f267 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 30 Nov 2016 11:30:44 -0500
Subject: DRTVWR-418: Update forwarding_api.cpp to match current API signature

Specifically, DriverCallback() was accepting several DWORD arguments that
should really be DWORD_PTR arguments. In a 32-bit compile, evidently that was
okay, but for 64 bits they're different sizes.
---
 indra/media_plugins/winmmshim/forwarding_api.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/media_plugins/winmmshim/forwarding_api.cpp b/indra/media_plugins/winmmshim/forwarding_api.cpp
index 33f0675028..c558062bd9 100644
--- a/indra/media_plugins/winmmshim/forwarding_api.cpp
+++ b/indra/media_plugins/winmmshim/forwarding_api.cpp
@@ -429,7 +429,7 @@ extern "C" {
 		return DefDriverProc_orig( dwDriverIdentifier, hdrvr, uMsg, lParam1, lParam2);
 	}
 
-	BOOL WINAPI DriverCallback( DWORD dwCallBack, DWORD dwFlags, HDRVR hdrvr, DWORD msg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
+	BOOL WINAPI DriverCallback( DWORD_PTR dwCallBack, DWORD dwFlags, HDRVR hdrvr, DWORD msg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
 	{
 		ll_winmm_shim_initialize();
 		//OutputDebugString(L"DriverCallback\n");
-- 
cgit v1.2.3


From 7b2cf53f782ac9ffa2766d006c870f10c320c9a0 Mon Sep 17 00:00:00 2001
From: Callum Prentice <callum@gmail.com>
Date: Wed, 30 Nov 2016 12:21:05 -0800
Subject: Pull in new version of KDU third party package that is build
 (correctly) as a static library vs. a stub library/DLL

---
 indra/llkdu/llimagej2ckdu.cpp | 5 -----
 1 file changed, 5 deletions(-)

(limited to 'indra')

diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp
index 0540e55e07..cb29da8f5f 100644
--- a/indra/llkdu/llimagej2ckdu.cpp
+++ b/indra/llkdu/llimagej2ckdu.cpp
@@ -26,11 +26,6 @@
 
 #include "linden_common.h"
 
-// based on this KDU support group posting:
-// https://groups.yahoo.com/neo/groups/kakadu_jpeg2000/conversations/messages/6691
-// Defining this values seems to fix the linker error that appeared with the 7.8 release
-#define CORESYS_IMPORTS
-
 #include "llimagej2ckdu.h"
 
 #include "lltimer.h"
-- 
cgit v1.2.3


From d4b23ccb8ab79425d7962def3be940d3dcd951ca Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 30 Nov 2016 16:24:32 -0500
Subject: DRTVWR-418: VertexMap::mapped_type -> size_t: we store map.size().

---
 indra/llcommon/lldependencies.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h
index 125bd6a835..de214a8943 100644
--- a/indra/llcommon/lldependencies.h
+++ b/indra/llcommon/lldependencies.h
@@ -508,7 +508,7 @@ public:
             // been explicitly added. Rely on std::map rejecting a second attempt
             // to insert the same key. Use the map's size() as the vertex number
             // to get a distinct value for each successful insertion.
-            typedef std::map<KEY, int> VertexMap;
+            typedef std::map<KEY, std::size_t> VertexMap;
             VertexMap vmap;
             // Nest each of these loops because !@#$%? MSVC warns us that its
             // former broken behavior has finally been fixed -- and our builds
-- 
cgit v1.2.3


From a47e16b3169b2fd91faf7a4dbfbba1f305298bce Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 30 Nov 2016 16:48:38 -0500
Subject: DRTVWR-418: Flesh out the set of Platform_arch_Manifest classes.

---
 indra/newview/viewer_manifest.py | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 1b6e8c9747..589d74a014 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -287,7 +287,8 @@ class ViewerManifest(LLManifest):
         random.shuffle(names)
         return ', '.join(names)
 
-class Windows_i686_Manifest(ViewerManifest):
+
+class WindowsManifest(ViewerManifest):
     def final_exe(self):
         return self.app_name_oneword()+".exe"
 
@@ -338,7 +339,7 @@ class Windows_i686_Manifest(ViewerManifest):
             print "Doesn't exist:", src
         
     def construct(self):
-        super(Windows_i686_Manifest, self).construct()
+        super(WindowsManifest, self).construct()
 
         pkgdir = os.path.join(self.args['build'], os.pardir, 'packages')
         relpkgdir = os.path.join(pkgdir, "lib", "release")
@@ -696,7 +697,17 @@ class Windows_i686_Manifest(ViewerManifest):
         self.package_file = installer_file
 
 
-class Darwin_i386_Manifest(ViewerManifest):
+class Windows_i686_Manifest(WindowsManifest):
+    # specialize when we must
+    pass
+
+
+class Windows_x86_64_Manifest(WindowsManifest):
+    # specialize when we must
+    pass
+
+
+class DarwinManifest(ViewerManifest):
     def is_packaging_viewer(self):
         # darwin requires full app bundle packaging even for debugging.
         return True
@@ -722,7 +733,7 @@ class Darwin_i386_Manifest(ViewerManifest):
 
             # most everything goes in the Resources directory
             if self.prefix(src="", dst="Resources"):
-                super(Darwin_i386_Manifest, self).construct()
+                super(DarwinManifest, self).construct()
 
                 if self.prefix("cursors_mac"):
                     self.path("*.tif")
@@ -1049,10 +1060,20 @@ class Darwin_i386_Manifest(ViewerManifest):
         self.package_file = finalname
         self.remove(sparsename)
 
-class Darwin_i686_Manifest(Darwin_i386_Manifest):
+
+class Darwin_i386_Manifest(DarwinManifest):
+    pass
+
+
+class Darwin_i686_Manifest(DarwinManifest):
     """alias in case arch is passed as i686 instead of i386"""
     pass
 
+
+class Darwin_x86_64_Manifest(DarwinManifest):
+    pass
+
+
 class LinuxManifest(ViewerManifest):
     def construct(self):
         super(LinuxManifest, self).construct()
-- 
cgit v1.2.3


From 222919be87386af66bba836fbb9495b64b4007f4 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Wed, 30 Nov 2016 20:10:28 -0500
Subject: DRTVWR-418: Adjust for LL_VIEWER_CHANNEL coming in unquoted.

Evidently the LL_VIEWER_CHANNEL macro (defined on the compiler command line)
used to contain enclosing double quotes. Something changed (newer CMake
version?) so that the macro now expands as Second Life Release rather than as
"Second Life Release". That leads to syntax errors when it's used.

Add C++ preprocessor trickery to stringize the value of the macro.
---
 indra/newview/llversioninfo.cpp            |  8 +++++++-
 indra/newview/tests/llversioninfo_test.cpp | 11 +++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp
index a0ca91672a..375dce485d 100644
--- a/indra/newview/llversioninfo.cpp
+++ b/indra/newview/llversioninfo.cpp
@@ -99,10 +99,16 @@ const std::string &LLVersionInfo::getShortVersion()
 
 namespace
 {
+	// LL_VIEWER_CHANNEL is a macro defined on the compiler command line. The
+	// macro expands to the string name of the channel, but without quotes. We
+	// need to turn it into a quoted string. This macro trick does that.
+#define stringize_inner(x) #x
+#define stringize_outer(x) stringize_inner(x)
+
 	/// Storage of the channel name the viewer is using.
 	//  The channel name is set by hardcoded constant, 
 	//  or by calling LLVersionInfo::resetChannel()
-	std::string sWorkingChannelName(LL_VIEWER_CHANNEL);
+	std::string sWorkingChannelName(stringize_outer(LL_VIEWER_CHANNEL));
 
 	// Storage for the "version and channel" string.
 	// This will get reset too.
diff --git a/indra/newview/tests/llversioninfo_test.cpp b/indra/newview/tests/llversioninfo_test.cpp
index 6b0be29c2d..f1f69f33f1 100644
--- a/indra/newview/tests/llversioninfo_test.cpp
+++ b/indra/newview/tests/llversioninfo_test.cpp
@@ -29,6 +29,13 @@
 
 #include "../llversioninfo.h"
 
+// LL_VIEWER_CHANNEL is a macro defined on the compiler command line. The
+// macro expands to the string name of the channel, but without quotes. We
+// need to turn it into a quoted string. This macro trick does that.
+#define stringize_inner(x) #x
+#define stringize_outer(x) stringize_inner(x)
+#define ll_viewer_channel stringize_outer(LL_VIEWER_CHANNEL)
+
 namespace tut
 {
     struct versioninfo
@@ -50,7 +57,7 @@ namespace tut
 			mShortVersion = stream.str();
 			stream.str("");
 
-			stream << LL_VIEWER_CHANNEL
+			stream << ll_viewer_channel
 				   << " "
 				   << mVersion;
 			mVersionAndChannel = stream.str();
@@ -89,7 +96,7 @@ namespace tut
 					  LL_VIEWER_VERSION_BUILD);
 		ensure_equals("Channel version", 
 					  LLVersionInfo::getChannel(), 
-					  LL_VIEWER_CHANNEL);
+					  ll_viewer_channel);
 		ensure_equals("Version String", 
 					  LLVersionInfo::getVersion(), 
 					  mVersion);
-- 
cgit v1.2.3


From 68d98acb920a49880662db0d20ccdf52edbc0151 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Thu, 1 Dec 2016 08:44:52 -0500
Subject: DRTVWR-418: In 64 bits, storing size_t in an int is a no-no.

---
 indra/llcommon/lldependencies.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h
index de214a8943..db2bbab8b0 100644
--- a/indra/llcommon/lldependencies.h
+++ b/indra/llcommon/lldependencies.h
@@ -124,8 +124,8 @@ public:
     virtual std::string describe(bool full=true) const;
 
 protected:
-    typedef std::vector< std::pair<int, int> > EdgeList;
-    typedef std::vector<int> VertexList;
+    typedef std::vector< std::pair<std::size_t, std::size_t> > EdgeList;
+    typedef std::vector<std::size_t> VertexList;
     VertexList topo_sort(int vertices, const EdgeList& edges) const;
 
     /**
-- 
cgit v1.2.3


From 8a461c00f4eb64027e4d81c081d6b7aa6d680d6e Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Thu, 1 Dec 2016 08:50:10 -0500
Subject: DRTVWR-418: Until we figure out how to say FIXED:NO to linker, don't.

The present CMake logic wants to pass FIXED:NO to the linker for 64-bit
builds, which on the face of it seems like a Good Thing: it permits code to be
relocated in memory, preventing collisions if two libraries happen to want to
load into overlapping address ranges.

However the way it's being specified is wrong and harmful. Passing /FIXED:NO
to the compiler command line engages /FI (Forced Include!) of a nonexistent
file XED:NO -- producing lots of baffling fatal compile errors.

Thanks Callum for diagnosing this!
---
 indra/llcommon/CMakeLists.txt                   | 2 +-
 indra/llplugin/CMakeLists.txt                   | 2 +-
 indra/media_plugins/base/CMakeLists.txt         | 2 +-
 indra/media_plugins/cef/CMakeLists.txt          | 2 +-
 indra/media_plugins/example/CMakeLists.txt      | 2 +-
 indra/media_plugins/gstreamer010/CMakeLists.txt | 2 +-
 indra/media_plugins/libvlc/CMakeLists.txt       | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index b29b2b2ccf..0468015bfa 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -247,7 +247,7 @@ if(LLCOMMON_LINK_SHARED)
   add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
   if(NOT ADDRESS_SIZE EQUAL 32)
     if(WINDOWS)
-      add_definitions(/FIXED:NO)
+      ##add_definitions(/FIXED:NO)
     else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
       add_definitions(-fPIC)
     endif(WINDOWS)
diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt
index 22f3b24dc5..2cdea67723 100644
--- a/indra/llplugin/CMakeLists.txt
+++ b/indra/llplugin/CMakeLists.txt
@@ -58,7 +58,7 @@ set_source_files_properties(${llplugin_HEADER_FILES}
 
 if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
-    add_definitions(/FIXED:NO)
+    ##add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
diff --git a/indra/media_plugins/base/CMakeLists.txt b/indra/media_plugins/base/CMakeLists.txt
index 6913235236..70c81d4023 100644
--- a/indra/media_plugins/base/CMakeLists.txt
+++ b/indra/media_plugins/base/CMakeLists.txt
@@ -30,7 +30,7 @@ include_directories(SYSTEM
 
 if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
-    add_definitions(/FIXED:NO)
+    ##add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
diff --git a/indra/media_plugins/cef/CMakeLists.txt b/indra/media_plugins/cef/CMakeLists.txt
index f9aada51a9..5db0a8fbfd 100644
--- a/indra/media_plugins/cef/CMakeLists.txt
+++ b/indra/media_plugins/cef/CMakeLists.txt
@@ -36,7 +36,7 @@ include_directories(SYSTEM
 
 if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
-    add_definitions(/FIXED:NO)
+    ##add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
diff --git a/indra/media_plugins/example/CMakeLists.txt b/indra/media_plugins/example/CMakeLists.txt
index d84e40855b..d2a17b1d76 100644
--- a/indra/media_plugins/example/CMakeLists.txt
+++ b/indra/media_plugins/example/CMakeLists.txt
@@ -34,7 +34,7 @@ include_directories(SYSTEM
 
 if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
-    add_definitions(/FIXED:NO)
+    ##add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
diff --git a/indra/media_plugins/gstreamer010/CMakeLists.txt b/indra/media_plugins/gstreamer010/CMakeLists.txt
index a10ea19b17..6d18814b1e 100644
--- a/indra/media_plugins/gstreamer010/CMakeLists.txt
+++ b/indra/media_plugins/gstreamer010/CMakeLists.txt
@@ -35,7 +35,7 @@ include_directories(SYSTEM
 
 if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
-    add_definitions(/FIXED:NO)
+    ##add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
diff --git a/indra/media_plugins/libvlc/CMakeLists.txt b/indra/media_plugins/libvlc/CMakeLists.txt
index d652a8dcf9..32574c7afa 100644
--- a/indra/media_plugins/libvlc/CMakeLists.txt
+++ b/indra/media_plugins/libvlc/CMakeLists.txt
@@ -35,7 +35,7 @@ include_directories(SYSTEM
 
 if(NOT ADDRESS_SIZE EQUAL 32)
   if(WINDOWS)
-    add_definitions(/FIXED:NO)
+    ##add_definitions(/FIXED:NO)
   else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
     add_definitions(-fPIC)
   endif(WINDOWS)
-- 
cgit v1.2.3


From 3d37848d0107eea3d821e22a57b7c41112efc924 Mon Sep 17 00:00:00 2001
From: Callum Prentice <callum@gmail.com>
Date: Fri, 2 Dec 2016 16:19:34 -0800
Subject: Remove winmmshim 'hack' from project and set volume directly from CEF
 media plugin using Windows system call.  WinMMShim was only needed for XP
 systems and since we no longer support XP, it is not required.

---
 indra/media_plugins/CMakeLists.txt                 |    1 -
 indra/media_plugins/cef/windows_volume_catcher.cpp |   55 +-
 indra/media_plugins/winmmshim/CMakeLists.txt       |   37 -
 indra/media_plugins/winmmshim/forwarding_api.cpp   | 1627 --------------------
 indra/media_plugins/winmmshim/forwarding_api.h     |  390 -----
 indra/media_plugins/winmmshim/winmm.def            |  218 ---
 indra/media_plugins/winmmshim/winmm_shim.cpp       |  219 ---
 7 files changed, 6 insertions(+), 2541 deletions(-)
 delete mode 100644 indra/media_plugins/winmmshim/CMakeLists.txt
 delete mode 100644 indra/media_plugins/winmmshim/forwarding_api.cpp
 delete mode 100644 indra/media_plugins/winmmshim/forwarding_api.h
 delete mode 100755 indra/media_plugins/winmmshim/winmm.def
 delete mode 100644 indra/media_plugins/winmmshim/winmm_shim.cpp

(limited to 'indra')

diff --git a/indra/media_plugins/CMakeLists.txt b/indra/media_plugins/CMakeLists.txt
index 22af50ab26..f654c15183 100644
--- a/indra/media_plugins/CMakeLists.txt
+++ b/indra/media_plugins/CMakeLists.txt
@@ -13,6 +13,5 @@ endif (DARWIN)
 
 if (WINDOWS)
     add_subdirectory(cef)
-    add_subdirectory(winmmshim)
     add_subdirectory(libvlc)
 endif (WINDOWS)
diff --git a/indra/media_plugins/cef/windows_volume_catcher.cpp b/indra/media_plugins/cef/windows_volume_catcher.cpp
index 0cfb810906..3b52941e96 100644
--- a/indra/media_plugins/cef/windows_volume_catcher.cpp
+++ b/indra/media_plugins/cef/windows_volume_catcher.cpp
@@ -42,44 +42,15 @@ private:
 	VolumeCatcherImpl();
 	~VolumeCatcherImpl();
 
-	typedef void (WINAPI *set_volume_func_t)(F32);
-	typedef void (WINAPI *set_mute_func_t)(bool);
-
-	set_volume_func_t mSetVolumeFunc;
-	set_mute_func_t mSetMuteFunc;
-
-	// tests if running on Vista, 7, 8 + once in CTOR
-	bool isWindowsVistaOrHigher();
-
 	F32 	mVolume;
 	F32 	mPan;
 	bool mSystemIsVistaOrHigher;
 };
 
-bool VolumeCatcherImpl::isWindowsVistaOrHigher()
-{
-	OSVERSIONINFO osvi;
-	ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
-	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-	GetVersionEx(&osvi);
-	return osvi.dwMajorVersion >= 6;
-}
-
 VolumeCatcherImpl::VolumeCatcherImpl()
 :	mVolume(1.0f),			// default volume is max
 	mPan(0.f)				// default pan is centered
 {
-	mSystemIsVistaOrHigher = isWindowsVistaOrHigher();
-
-	if ( ! mSystemIsVistaOrHigher )
-	{
-		HMODULE handle = ::LoadLibrary(L"winmm.dll");
-		if(handle)
-		{
-			mSetVolumeFunc = (set_volume_func_t)::GetProcAddress(handle, "setPluginVolume");
-			mSetMuteFunc = (set_mute_func_t)::GetProcAddress(handle, "setPluginMute");
-		}
-	}
 }
 
 VolumeCatcherImpl::~VolumeCatcherImpl()
@@ -90,26 +61,12 @@ void VolumeCatcherImpl::setVolume(F32 volume)
 {
 	mVolume = volume;
 
-	if ( mSystemIsVistaOrHigher )
-	{
-		// set both left/right to same volume
-		// TODO: use pan value to set independently
-		DWORD left_channel  = (DWORD)(mVolume * 65535.0f);
-		DWORD right_channel =  (DWORD)(mVolume * 65535.0f);
-		DWORD hw_volume = left_channel << 16 | right_channel;
-		::waveOutSetVolume(NULL, hw_volume);
-	}
-	else
-	{
-		if (mSetMuteFunc)
-		{
-			mSetMuteFunc(volume == 0.f);
-		}
-		if (mSetVolumeFunc)
-		{
-			mSetVolumeFunc(mVolume);
-		}
-	}
+	// set both left/right to same volume
+	// TODO: use pan value to set independently
+	DWORD left_channel = (DWORD)(mVolume * 65535.0f);
+	DWORD right_channel = (DWORD)(mVolume * 65535.0f);
+	DWORD hw_volume = left_channel << 16 | right_channel;
+	::waveOutSetVolume(NULL, hw_volume);
 }
 
 void VolumeCatcherImpl::setPan(F32 pan)
diff --git a/indra/media_plugins/winmmshim/CMakeLists.txt b/indra/media_plugins/winmmshim/CMakeLists.txt
deleted file mode 100644
index 6890589892..0000000000
--- a/indra/media_plugins/winmmshim/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- cmake -*-
-
-project(winmm_shim)
-
-### winmm_shim
-# *HACK - override msvcrt implementation (intialized on 00-Common) to be
-# statically linked for winmm.dll this relies on vc taking the last flag on
-# the command line
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
-
-set(winmm_shim_SOURCE_FILES
-    forwarding_api.cpp
-    winmm_shim.cpp
-    )
-
-set(winmm_shim_HEADER_FILES
-    forwarding_api.h
-    winmm.def
-    )
-
-list(APPEND winmm_shim_SOURCE_FILES ${winmm_shim_HEADER_FILES})
-
-add_library(winmm_shim
-    SHARED
-    ${winmm_shim_SOURCE_FILES}
-)
-
-if (WINDOWS)
-  set_target_properties(
-    winmm_shim
-    PROPERTIES
-    LINK_FLAGS "/MANIFEST:NO"
-    OUTPUT_NAME "winmm"
-    )
-endif (WINDOWS)
diff --git a/indra/media_plugins/winmmshim/forwarding_api.cpp b/indra/media_plugins/winmmshim/forwarding_api.cpp
deleted file mode 100644
index c558062bd9..0000000000
--- a/indra/media_plugins/winmmshim/forwarding_api.cpp
+++ /dev/null
@@ -1,1627 +0,0 @@
-/** 
- * @file forwarding_api.cpp
- * @brief forwards winmm API calls to real winmm.dll
- *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "forwarding_api.h"
-
-CloseDriver_type CloseDriver_orig;
-OpenDriver_type OpenDriver_orig;
-SendDriverMessage_type SendDriverMessage_orig;
-DrvGetModuleHandle_type DrvGetModuleHandle_orig;
-GetDriverModuleHandle_type GetDriverModuleHandle_orig;
-DefDriverProc_type DefDriverProc_orig;
-DriverCallback_type DriverCallback_orig;
-mmsystemGetVersion_type mmsystemGetVersion_orig;
-sndPlaySoundA_type sndPlaySoundA_orig;
-sndPlaySoundW_type sndPlaySoundW_orig;
-PlaySoundA_type PlaySoundA_orig;
-PlaySoundW_type PlaySoundW_orig;
-waveOutGetNumDevs_type waveOutGetNumDevs_orig;
-waveOutGetDevCapsA_type waveOutGetDevCapsA_orig;
-waveOutGetDevCapsW_type waveOutGetDevCapsW_orig;
-waveOutGetVolume_type waveOutGetVolume_orig;
-waveOutSetVolume_type waveOutSetVolume_orig;
-waveOutGetErrorTextA_type waveOutGetErrorTextA_orig;
-waveOutGetErrorTextW_type waveOutGetErrorTextW_orig;
-waveOutOpen_type waveOutOpen_orig;
-waveOutClose_type waveOutClose_orig;
-waveOutPrepareHeader_type waveOutPrepareHeader_orig;
-waveOutUnprepareHeader_type waveOutUnprepareHeader_orig;
-waveOutWrite_type waveOutWrite_orig;
-waveOutPause_type waveOutPause_orig;
-waveOutRestart_type waveOutRestart_orig;
-waveOutReset_type waveOutReset_orig;
-waveOutBreakLoop_type waveOutBreakLoop_orig;
-waveOutGetPosition_type waveOutGetPosition_orig;
-waveOutGetPitch_type waveOutGetPitch_orig;
-waveOutSetPitch_type waveOutSetPitch_orig;
-waveOutGetPlaybackRate_type waveOutGetPlaybackRate_orig;
-waveOutSetPlaybackRate_type waveOutSetPlaybackRate_orig;
-waveOutGetID_type waveOutGetID_orig;
-waveOutMessage_type waveOutMessage_orig;
-waveInGetNumDevs_type waveInGetNumDevs_orig;
-waveInGetDevCapsA_type waveInGetDevCapsA_orig;
-waveInGetDevCapsW_type waveInGetDevCapsW_orig;
-waveInGetErrorTextA_type waveInGetErrorTextA_orig;
-waveInGetErrorTextW_type waveInGetErrorTextW_orig;
-waveInOpen_type waveInOpen_orig;
-waveInClose_type waveInClose_orig;
-waveInPrepareHeader_type waveInPrepareHeader_orig;
-waveInUnprepareHeader_type waveInUnprepareHeader_orig;
-waveInAddBuffer_type waveInAddBuffer_orig;
-waveInStart_type waveInStart_orig;
-waveInStop_type waveInStop_orig;
-waveInReset_type waveInReset_orig;
-waveInGetPosition_type waveInGetPosition_orig;
-waveInGetID_type waveInGetID_orig;
-waveInMessage_type waveInMessage_orig;
-midiOutGetNumDevs_type midiOutGetNumDevs_orig;
-midiStreamOpen_type midiStreamOpen_orig;
-midiStreamClose_type midiStreamClose_orig;
-midiStreamProperty_type midiStreamProperty_orig;
-midiStreamPosition_type midiStreamPosition_orig;
-midiStreamOut_type midiStreamOut_orig;
-midiStreamPause_type midiStreamPause_orig;
-midiStreamRestart_type midiStreamRestart_orig;
-midiStreamStop_type midiStreamStop_orig;
-midiConnect_type midiConnect_orig;
-midiDisconnect_type midiDisconnect_orig;
-midiOutGetDevCapsA_type midiOutGetDevCapsA_orig;
-midiOutGetDevCapsW_type midiOutGetDevCapsW_orig;
-midiOutGetVolume_type midiOutGetVolume_orig;
-midiOutSetVolume_type midiOutSetVolume_orig;
-midiOutGetErrorTextA_type midiOutGetErrorTextA_orig;
-midiOutGetErrorTextW_type midiOutGetErrorTextW_orig;
-midiOutOpen_type midiOutOpen_orig;
-midiOutClose_type midiOutClose_orig;
-midiOutPrepareHeader_type midiOutPrepareHeader_orig;
-midiOutUnprepareHeader_type midiOutUnprepareHeader_orig;
-midiOutShortMsg_type midiOutShortMsg_orig;
-midiOutLongMsg_type midiOutLongMsg_orig;
-midiOutReset_type midiOutReset_orig;
-midiOutCachePatches_type midiOutCachePatches_orig;
-midiOutCacheDrumPatches_type midiOutCacheDrumPatches_orig;
-midiOutGetID_type midiOutGetID_orig;
-midiOutMessage_type midiOutMessage_orig;
-midiInGetNumDevs_type midiInGetNumDevs_orig;
-midiInGetDevCapsA_type midiInGetDevCapsA_orig;
-midiInGetDevCapsW_type midiInGetDevCapsW_orig;
-midiInGetErrorTextA_type midiInGetErrorTextA_orig;
-midiInGetErrorTextW_type midiInGetErrorTextW_orig;
-midiInOpen_type midiInOpen_orig;
-midiInClose_type midiInClose_orig;
-midiInPrepareHeader_type midiInPrepareHeader_orig;
-midiInUnprepareHeader_type midiInUnprepareHeader_orig;
-midiInAddBuffer_type midiInAddBuffer_orig;
-midiInStart_type midiInStart_orig;
-midiInStop_type midiInStop_orig;
-midiInReset_type midiInReset_orig;
-midiInGetID_type midiInGetID_orig;
-midiInMessage_type midiInMessage_orig;
-auxGetNumDevs_type auxGetNumDevs_orig;
-auxGetDevCapsA_type auxGetDevCapsA_orig;
-auxGetDevCapsW_type auxGetDevCapsW_orig;
-auxSetVolume_type auxSetVolume_orig;
-auxGetVolume_type auxGetVolume_orig;
-auxOutMessage_type auxOutMessage_orig;
-mixerGetNumDevs_type mixerGetNumDevs_orig;
-mixerGetDevCapsA_type mixerGetDevCapsA_orig;
-mixerGetDevCapsW_type mixerGetDevCapsW_orig;
-mixerOpen_type mixerOpen_orig;
-mixerClose_type mixerClose_orig;
-mixerMessage_type mixerMessage_orig;
-mixerGetLineInfoA_type mixerGetLineInfoA_orig;
-mixerGetLineInfoW_type mixerGetLineInfoW_orig;
-mixerGetID_type mixerGetID_orig;
-mixerGetLineControlsA_type mixerGetLineControlsA_orig;
-mixerGetLineControlsW_type mixerGetLineControlsW_orig;
-mixerGetControlDetailsA_type mixerGetControlDetailsA_orig;
-mixerGetControlDetailsW_type mixerGetControlDetailsW_orig;
-mixerSetControlDetails_type mixerSetControlDetails_orig;
-mmGetCurrentTask_type mmGetCurrentTask_orig;
-mmTaskBlock_type mmTaskBlock_orig;
-mmTaskCreate_type mmTaskCreate_orig;
-mmTaskSignal_type mmTaskSignal_orig;
-mmTaskYield_type mmTaskYield_orig;
-timeGetSystemTime_type timeGetSystemTime_orig;
-timeGetTime_type timeGetTime_orig;
-timeSetEvent_type timeSetEvent_orig;
-timeKillEvent_type timeKillEvent_orig;
-timeGetDevCaps_type timeGetDevCaps_orig;
-timeBeginPeriod_type timeBeginPeriod_orig;
-timeEndPeriod_type timeEndPeriod_orig;
-joyGetNumDevs_type joyGetNumDevs_orig;
-joyConfigChanged_type joyConfigChanged_orig;
-joyGetDevCapsA_type joyGetDevCapsA_orig;
-joyGetDevCapsW_type joyGetDevCapsW_orig;
-joyGetPos_type joyGetPos_orig;
-joyGetPosEx_type joyGetPosEx_orig;
-joyGetThreshold_type joyGetThreshold_orig;
-joyReleaseCapture_type joyReleaseCapture_orig;
-joySetCapture_type joySetCapture_orig;
-joySetThreshold_type joySetThreshold_orig;
-mmioStringToFOURCCA_type mmioStringToFOURCCA_orig;
-mmioStringToFOURCCW_type mmioStringToFOURCCW_orig;
-mmioInstallIOProcA_type mmioInstallIOProcA_orig;
-mmioInstallIOProcW_type mmioInstallIOProcW_orig;
-mmioOpenA_type mmioOpenA_orig;
-mmioOpenW_type mmioOpenW_orig;
-mmioRenameA_type mmioRenameA_orig;
-mmioRenameW_type mmioRenameW_orig;
-mmioClose_type mmioClose_orig;
-mmioRead_type mmioRead_orig;
-mmioWrite_type mmioWrite_orig;
-mmioSeek_type mmioSeek_orig;
-mmioGetInfo_type mmioGetInfo_orig;
-mmioSetInfo_type mmioSetInfo_orig;
-mmioSetBuffer_type mmioSetBuffer_orig;
-mmioFlush_type mmioFlush_orig;
-mmioAdvance_type mmioAdvance_orig;
-mmioSendMessage_type mmioSendMessage_orig;
-mmioDescend_type mmioDescend_orig;
-mmioAscend_type mmioAscend_orig;
-mmioCreateChunk_type mmioCreateChunk_orig;
-mciSendCommandA_type mciSendCommandA_orig;
-mciSendCommandW_type mciSendCommandW_orig;
-mciSendStringA_type mciSendStringA_orig;
-mciSendStringW_type mciSendStringW_orig;
-mciGetDeviceIDA_type mciGetDeviceIDA_orig;
-mciGetDeviceIDW_type mciGetDeviceIDW_orig;
-mciGetDeviceIDFromElementIDA_type mciGetDeviceIDFromElementIDA_orig;
-mciGetDeviceIDFromElementIDW_type mciGetDeviceIDFromElementIDW_orig;
-mciGetDriverData_type mciGetDriverData_orig;
-mciGetErrorStringA_type mciGetErrorStringA_orig;
-mciGetErrorStringW_type mciGetErrorStringW_orig;
-mciSetDriverData_type mciSetDriverData_orig;
-mciDriverNotify_type mciDriverNotify_orig;
-mciDriverYield_type mciDriverYield_orig;
-mciSetYieldProc_type mciSetYieldProc_orig;
-mciFreeCommandResource_type mciFreeCommandResource_orig;
-mciGetCreatorTask_type mciGetCreatorTask_orig;
-mciGetYieldProc_type mciGetYieldProc_orig;
-mciLoadCommandResource_type mciLoadCommandResource_orig;
-mciExecute_type mciExecute_orig;
-
-// grab pointers to function calls in the real DLL
-void init_function_pointers(HMODULE winmm_handle)
-{	
-	CloseDriver_orig = (CloseDriver_type)::GetProcAddress(winmm_handle, "CloseDriver");
-	OpenDriver_orig = (OpenDriver_type)::GetProcAddress(winmm_handle, "OpenDriver");
-	SendDriverMessage_orig = (SendDriverMessage_type)::GetProcAddress(winmm_handle, "SendDriverMessage");
-	DrvGetModuleHandle_orig = (DrvGetModuleHandle_type)::GetProcAddress(winmm_handle, "DrvGetModuleHandle");
-	GetDriverModuleHandle_orig = (GetDriverModuleHandle_type)::GetProcAddress(winmm_handle, "GetDriverModuleHandle");
-	DefDriverProc_orig = (DefDriverProc_type)::GetProcAddress(winmm_handle, "DefDriverProc");
-	DriverCallback_orig = (DriverCallback_type)::GetProcAddress(winmm_handle, "DriverCallback");
-	mmsystemGetVersion_orig = (mmsystemGetVersion_type)::GetProcAddress(winmm_handle, "mmsystemGetVersion");
-	sndPlaySoundA_orig = (sndPlaySoundA_type)::GetProcAddress(winmm_handle, "sndPlaySoundA");
-	sndPlaySoundW_orig = (sndPlaySoundW_type)::GetProcAddress(winmm_handle, "sndPlaySoundW");
-	PlaySoundA_orig = (PlaySoundA_type)::GetProcAddress(winmm_handle, "PlaySoundA");
-	PlaySoundW_orig = (PlaySoundW_type)::GetProcAddress(winmm_handle, "PlaySoundW");
-	waveOutGetNumDevs_orig = (waveOutGetNumDevs_type)::GetProcAddress(winmm_handle, "waveOutGetNumDevs");
-	waveOutGetDevCapsA_orig = (waveOutGetDevCapsA_type)::GetProcAddress(winmm_handle, "waveOutGetDevCapsA");
-	waveOutGetDevCapsW_orig = (waveOutGetDevCapsW_type)::GetProcAddress(winmm_handle, "waveOutGetDevCapsW");
-	waveOutGetVolume_orig = (waveOutGetVolume_type)::GetProcAddress(winmm_handle, "waveOutGetVolume");
-	waveOutSetVolume_orig = (waveOutSetVolume_type)::GetProcAddress(winmm_handle, "waveOutSetVolume");
-	waveOutGetErrorTextA_orig = (waveOutGetErrorTextA_type)::GetProcAddress(winmm_handle, "waveOutGetErrorTextA");
-	waveOutGetErrorTextW_orig = (waveOutGetErrorTextW_type)::GetProcAddress(winmm_handle, "waveOutGetErrorTextW");
-	waveOutOpen_orig = (waveOutOpen_type)::GetProcAddress(winmm_handle, "waveOutOpen");
-	waveOutClose_orig = (waveOutClose_type)::GetProcAddress(winmm_handle, "waveOutClose");
-	waveOutPrepareHeader_orig = (waveOutPrepareHeader_type)::GetProcAddress(winmm_handle, "waveOutPrepareHeader");
-	waveOutUnprepareHeader_orig = (waveOutUnprepareHeader_type)::GetProcAddress(winmm_handle, "waveOutUnprepareHeader");
-	waveOutWrite_orig = (waveOutWrite_type)::GetProcAddress(winmm_handle, "waveOutWrite");
-	waveOutPause_orig = (waveOutPause_type)::GetProcAddress(winmm_handle, "waveOutPause");
-	waveOutRestart_orig = (waveOutRestart_type)::GetProcAddress(winmm_handle, "waveOutRestart");
-	waveOutReset_orig = (waveOutReset_type)::GetProcAddress(winmm_handle, "waveOutReset");
-	waveOutBreakLoop_orig = (waveOutBreakLoop_type)::GetProcAddress(winmm_handle, "waveOutBreakLoop");
-	waveOutGetPosition_orig = (waveOutGetPosition_type)::GetProcAddress(winmm_handle, "waveOutGetPosition");
-	waveOutGetPitch_orig = (waveOutGetPitch_type)::GetProcAddress(winmm_handle, "waveOutGetPitch");
-	waveOutSetPitch_orig = (waveOutSetPitch_type)::GetProcAddress(winmm_handle, "waveOutSetPitch");
-	waveOutGetPlaybackRate_orig = (waveOutGetPlaybackRate_type)::GetProcAddress(winmm_handle, "waveOutGetPlaybackRate");
-	waveOutSetPlaybackRate_orig = (waveOutSetPlaybackRate_type)::GetProcAddress(winmm_handle, "waveOutSetPlaybackRate");
-	waveOutGetID_orig = (waveOutGetID_type)::GetProcAddress(winmm_handle, "waveOutGetID");
-	waveOutMessage_orig = (waveOutMessage_type)::GetProcAddress(winmm_handle, "waveOutMessage");
-	waveInGetNumDevs_orig = (waveInGetNumDevs_type)::GetProcAddress(winmm_handle, "waveInGetNumDevs");
-	waveInGetDevCapsA_orig = (waveInGetDevCapsA_type)::GetProcAddress(winmm_handle, "waveInGetDevCapsA");
-	waveInGetDevCapsW_orig = (waveInGetDevCapsW_type)::GetProcAddress(winmm_handle, "waveInGetDevCapsW");
-	waveInGetErrorTextA_orig = (waveInGetErrorTextA_type)::GetProcAddress(winmm_handle, "waveInGetErrorTextA");
-	waveInGetErrorTextW_orig = (waveInGetErrorTextW_type)::GetProcAddress(winmm_handle, "waveInGetErrorTextW");
-	waveInOpen_orig = (waveInOpen_type)::GetProcAddress(winmm_handle, "waveInOpen");
-	waveInClose_orig = (waveInClose_type)::GetProcAddress(winmm_handle, "waveInClose");
-	waveInPrepareHeader_orig = (waveInPrepareHeader_type)::GetProcAddress(winmm_handle, "waveInPrepareHeader");
-	waveInUnprepareHeader_orig = (waveInUnprepareHeader_type)::GetProcAddress(winmm_handle, "waveInUnprepareHeader");
-	waveInAddBuffer_orig = (waveInAddBuffer_type)::GetProcAddress(winmm_handle, "waveInAddBuffer");
-	waveInStart_orig = (waveInStart_type)::GetProcAddress(winmm_handle, "waveInStart");
-	waveInStop_orig = (waveInStop_type)::GetProcAddress(winmm_handle, "waveInStop");
-	waveInReset_orig = (waveInReset_type)::GetProcAddress(winmm_handle, "waveInReset");
-	waveInGetPosition_orig = (waveInGetPosition_type)::GetProcAddress(winmm_handle, "waveInGetPosition");
-	waveInGetID_orig = (waveInGetID_type)::GetProcAddress(winmm_handle, "waveInGetID");
-	waveInMessage_orig = (waveInMessage_type)::GetProcAddress(winmm_handle, "waveInMessage");
-	midiOutGetNumDevs_orig = (midiOutGetNumDevs_type)::GetProcAddress(winmm_handle, "midiOutGetNumDevs");
-	midiStreamOpen_orig = (midiStreamOpen_type)::GetProcAddress(winmm_handle, "midiStreamOpen");
-	midiStreamClose_orig = (midiStreamClose_type)::GetProcAddress(winmm_handle, "midiStreamClose");
-	midiStreamProperty_orig = (midiStreamProperty_type)::GetProcAddress(winmm_handle, "midiStreamProperty");
-	midiStreamPosition_orig = (midiStreamPosition_type)::GetProcAddress(winmm_handle, "midiStreamPosition");
-	midiStreamOut_orig = (midiStreamOut_type)::GetProcAddress(winmm_handle, "midiStreamOut");
-	midiStreamPause_orig = (midiStreamPause_type)::GetProcAddress(winmm_handle, "midiStreamPause");
-	midiStreamRestart_orig = (midiStreamRestart_type)::GetProcAddress(winmm_handle, "midiStreamRestart");
-	midiStreamStop_orig = (midiStreamStop_type)::GetProcAddress(winmm_handle, "midiStreamStop");
-	midiConnect_orig = (midiConnect_type)::GetProcAddress(winmm_handle, "midiConnect");
-	midiDisconnect_orig = (midiDisconnect_type)::GetProcAddress(winmm_handle, "midiDisconnect");
-	midiOutGetDevCapsA_orig = (midiOutGetDevCapsA_type)::GetProcAddress(winmm_handle, "midiOutGetDevCapsA");
-	midiOutGetDevCapsW_orig = (midiOutGetDevCapsW_type)::GetProcAddress(winmm_handle, "midiOutGetDevCapsW");
-	midiOutGetVolume_orig = (midiOutGetVolume_type)::GetProcAddress(winmm_handle, "midiOutGetVolume");
-	midiOutSetVolume_orig = (midiOutSetVolume_type)::GetProcAddress(winmm_handle, "midiOutSetVolume");
-	midiOutGetErrorTextA_orig = (midiOutGetErrorTextA_type)::GetProcAddress(winmm_handle, "midiOutGetErrorTextA");
-	midiOutGetErrorTextW_orig = (midiOutGetErrorTextW_type)::GetProcAddress(winmm_handle, "midiOutGetErrorTextW");
-	midiOutOpen_orig = (midiOutOpen_type)::GetProcAddress(winmm_handle, "midiOutOpen");
-	midiOutClose_orig = (midiOutClose_type)::GetProcAddress(winmm_handle, "midiOutClose");
-	midiOutPrepareHeader_orig = (midiOutPrepareHeader_type)::GetProcAddress(winmm_handle, "midiOutPrepareHeader");
-	midiOutUnprepareHeader_orig = (midiOutUnprepareHeader_type)::GetProcAddress(winmm_handle, "midiOutUnprepareHeader");
-	midiOutShortMsg_orig = (midiOutShortMsg_type)::GetProcAddress(winmm_handle, "midiOutShortMsg");
-	midiOutLongMsg_orig = (midiOutLongMsg_type)::GetProcAddress(winmm_handle, "midiOutLongMsg");
-	midiOutReset_orig = (midiOutReset_type)::GetProcAddress(winmm_handle, "midiOutReset");
-	midiOutCachePatches_orig = (midiOutCachePatches_type)::GetProcAddress(winmm_handle, "midiOutCachePatches");
-	midiOutCacheDrumPatches_orig = (midiOutCacheDrumPatches_type)::GetProcAddress(winmm_handle, "midiOutCacheDrumPatches");
-	midiOutGetID_orig = (midiOutGetID_type)::GetProcAddress(winmm_handle, "midiOutGetID");
-	midiOutMessage_orig = (midiOutMessage_type)::GetProcAddress(winmm_handle, "midiOutMessage");
-	midiInGetNumDevs_orig = (midiInGetNumDevs_type)::GetProcAddress(winmm_handle, "midiInGetNumDevs");
-	midiInGetDevCapsA_orig = (midiInGetDevCapsA_type)::GetProcAddress(winmm_handle, "midiInGetDevCapsA");
-	midiInGetDevCapsW_orig = (midiInGetDevCapsW_type)::GetProcAddress(winmm_handle, "midiInGetDevCapsW");
-	midiInGetErrorTextA_orig = (midiInGetErrorTextA_type)::GetProcAddress(winmm_handle, "midiInGetErrorTextA");
-	midiInGetErrorTextW_orig = (midiInGetErrorTextW_type)::GetProcAddress(winmm_handle, "midiInGetErrorTextW");
-	midiInOpen_orig = (midiInOpen_type)::GetProcAddress(winmm_handle, "midiInOpen");
-	midiInClose_orig = (midiInClose_type)::GetProcAddress(winmm_handle, "midiInClose");
-	midiInPrepareHeader_orig = (midiInPrepareHeader_type)::GetProcAddress(winmm_handle, "midiInPrepareHeader");
-	midiInUnprepareHeader_orig = (midiInUnprepareHeader_type)::GetProcAddress(winmm_handle, "midiInUnprepareHeader");
-	midiInAddBuffer_orig = (midiInAddBuffer_type)::GetProcAddress(winmm_handle, "midiInAddBuffer");
-	midiInStart_orig = (midiInStart_type)::GetProcAddress(winmm_handle, "midiInStart");
-	midiInStop_orig = (midiInStop_type)::GetProcAddress(winmm_handle, "midiInStop");
-	midiInReset_orig = (midiInReset_type)::GetProcAddress(winmm_handle, "midiInReset");
-	midiInGetID_orig = (midiInGetID_type)::GetProcAddress(winmm_handle, "midiInGetID");
-	midiInMessage_orig = (midiInMessage_type)::GetProcAddress(winmm_handle, "midiInMessage");
-	auxGetNumDevs_orig = (auxGetNumDevs_type)::GetProcAddress(winmm_handle, "auxGetNumDevs");
-	auxGetDevCapsA_orig = (auxGetDevCapsA_type)::GetProcAddress(winmm_handle, "auxGetDevCapsA");
-	auxGetDevCapsW_orig = (auxGetDevCapsW_type)::GetProcAddress(winmm_handle, "auxGetDevCapsW");
-	auxSetVolume_orig = (auxSetVolume_type)::GetProcAddress(winmm_handle, "auxSetVolume");
-	auxGetVolume_orig = (auxGetVolume_type)::GetProcAddress(winmm_handle, "auxGetVolume");
-	auxOutMessage_orig = (auxOutMessage_type)::GetProcAddress(winmm_handle, "auxOutMessage");
-	mixerGetNumDevs_orig = (mixerGetNumDevs_type)::GetProcAddress(winmm_handle, "mixerGetNumDevs");
-	mixerGetDevCapsA_orig = (mixerGetDevCapsA_type)::GetProcAddress(winmm_handle, "mixerGetDevCapsA");
-	mixerGetDevCapsW_orig = (mixerGetDevCapsW_type)::GetProcAddress(winmm_handle, "mixerGetDevCapsW");
-	mixerOpen_orig = (mixerOpen_type)::GetProcAddress(winmm_handle, "mixerOpen");
-	mixerClose_orig = (mixerClose_type)::GetProcAddress(winmm_handle, "mixerClose");
-	mixerMessage_orig = (mixerMessage_type)::GetProcAddress(winmm_handle, "mixerMessage");
-	mixerGetLineInfoA_orig = (mixerGetLineInfoA_type)::GetProcAddress(winmm_handle, "mixerGetLineInfoA");
-	mixerGetLineInfoW_orig = (mixerGetLineInfoW_type)::GetProcAddress(winmm_handle, "mixerGetLineInfoW");
-	mixerGetID_orig = (mixerGetID_type)::GetProcAddress(winmm_handle, "mixerGetID");
-	mixerGetLineControlsA_orig = (mixerGetLineControlsA_type)::GetProcAddress(winmm_handle, "mixerGetLineControlsA");
-	mixerGetLineControlsW_orig = (mixerGetLineControlsW_type)::GetProcAddress(winmm_handle, "mixerGetLineControlsW");
-	mixerGetControlDetailsA_orig = (mixerGetControlDetailsA_type)::GetProcAddress(winmm_handle, "mixerGetControlDetailsA");
-	mixerGetControlDetailsW_orig = (mixerGetControlDetailsW_type)::GetProcAddress(winmm_handle, "mixerGetControlDetailsW");
-	mixerSetControlDetails_orig = (mixerSetControlDetails_type)::GetProcAddress(winmm_handle, "mixerSetControlDetails");
-	mmGetCurrentTask_orig = (mmGetCurrentTask_type)::GetProcAddress(winmm_handle, "mmGetCurrentTask");
-	mmTaskBlock_orig = (mmTaskBlock_type)::GetProcAddress(winmm_handle, "mmTaskBlock");
-	mmTaskCreate_orig = (mmTaskCreate_type)::GetProcAddress(winmm_handle, "mmTaskCreate");
-	mmTaskSignal_orig = (mmTaskSignal_type)::GetProcAddress(winmm_handle, "mmTaskSignal");
-	mmTaskYield_orig = (mmTaskYield_type)::GetProcAddress(winmm_handle, "mmTaskYield");
-	timeGetSystemTime_orig = (timeGetSystemTime_type)::GetProcAddress(winmm_handle, "timeGetSystemTime");
-	timeGetTime_orig = (timeGetTime_type)::GetProcAddress(winmm_handle, "timeGetTime");
-	timeSetEvent_orig = (timeSetEvent_type)::GetProcAddress(winmm_handle, "timeSetEvent");
-	timeKillEvent_orig = (timeKillEvent_type)::GetProcAddress(winmm_handle, "timeKillEvent");
-	timeGetDevCaps_orig = (timeGetDevCaps_type)::GetProcAddress(winmm_handle, "timeGetDevCaps");
-	timeBeginPeriod_orig = (timeBeginPeriod_type)::GetProcAddress(winmm_handle, "timeBeginPeriod");
-	timeEndPeriod_orig = (timeEndPeriod_type)::GetProcAddress(winmm_handle, "timeEndPeriod");
-	joyGetNumDevs_orig = (joyGetNumDevs_type)::GetProcAddress(winmm_handle, "joyGetNumDevs");
-	joyConfigChanged_orig = (joyConfigChanged_type)::GetProcAddress(winmm_handle, "joyConfigChanged");
-	joyGetDevCapsA_orig = (joyGetDevCapsA_type)::GetProcAddress(winmm_handle, "joyGetDevCapsA");
-	joyGetDevCapsW_orig = (joyGetDevCapsW_type)::GetProcAddress(winmm_handle, "joyGetDevCapsW");
-	joyGetPos_orig = (joyGetPos_type)::GetProcAddress(winmm_handle, "joyGetPos");
-	joyGetPosEx_orig = (joyGetPosEx_type)::GetProcAddress(winmm_handle, "joyGetPosEx");
-	joyGetThreshold_orig = (joyGetThreshold_type)::GetProcAddress(winmm_handle, "joyGetThreshold");
-	joyReleaseCapture_orig = (joyReleaseCapture_type)::GetProcAddress(winmm_handle, "joyReleaseCapture");
-	joySetCapture_orig = (joySetCapture_type)::GetProcAddress(winmm_handle, "joySetCapture");
-	joySetThreshold_orig = (joySetThreshold_type)::GetProcAddress(winmm_handle, "joySetThreshold");
-	mciDriverNotify_orig = (mciDriverNotify_type)::GetProcAddress(winmm_handle, "mciDriverNotify");
-	mciDriverYield_orig = (mciDriverYield_type)::GetProcAddress(winmm_handle, "mciDriverYield");
-	mmioStringToFOURCCA_orig = (mmioStringToFOURCCA_type)::GetProcAddress(winmm_handle, "mmioStringToFOURCCA");
-	mmioStringToFOURCCW_orig = (mmioStringToFOURCCW_type)::GetProcAddress(winmm_handle, "mmioStringToFOURCCW");
-	mmioInstallIOProcA_orig = (mmioInstallIOProcA_type)::GetProcAddress(winmm_handle, "mmioInstallIOProcA");
-	mmioInstallIOProcW_orig = (mmioInstallIOProcW_type)::GetProcAddress(winmm_handle, "mmioInstallIOProcW");
-	mmioOpenA_orig = (mmioOpenA_type)::GetProcAddress(winmm_handle, "mmioOpenA");
-	mmioOpenW_orig = (mmioOpenW_type)::GetProcAddress(winmm_handle, "mmioOpenW");
-	mmioRenameA_orig = (mmioRenameA_type)::GetProcAddress(winmm_handle, "mmioRenameA");
-	mmioRenameW_orig = (mmioRenameW_type)::GetProcAddress(winmm_handle, "mmioRenameW");
-	mmioClose_orig = (mmioClose_type)::GetProcAddress(winmm_handle, "mmioClose");
-	mmioRead_orig = (mmioRead_type)::GetProcAddress(winmm_handle, "mmioRead");
-	mmioWrite_orig = (mmioWrite_type)::GetProcAddress(winmm_handle, "mmioWrite");
-	mmioSeek_orig = (mmioSeek_type)::GetProcAddress(winmm_handle, "mmioSeek");
-	mmioGetInfo_orig = (mmioGetInfo_type)::GetProcAddress(winmm_handle, "mmioGetInfo");
-	mmioSetInfo_orig = (mmioSetInfo_type)::GetProcAddress(winmm_handle, "mmioSetInfo");
-	mmioSetBuffer_orig = (mmioSetBuffer_type)::GetProcAddress(winmm_handle, "mmioSetBuffer");
-	mmioFlush_orig = (mmioFlush_type)::GetProcAddress(winmm_handle, "mmioFlush");
-	mmioAdvance_orig = (mmioAdvance_type)::GetProcAddress(winmm_handle, "mmioAdvance");
-	mmioSendMessage_orig = (mmioSendMessage_type)::GetProcAddress(winmm_handle, "mmioSendMessage");
-	mmioDescend_orig = (mmioDescend_type)::GetProcAddress(winmm_handle, "mmioDescend");
-	mmioAscend_orig = (mmioAscend_type)::GetProcAddress(winmm_handle, "mmioAscend");
-	mmioCreateChunk_orig = (mmioCreateChunk_type)::GetProcAddress(winmm_handle, "mmioCreateChunk");
-	mciSendCommandA_orig = (mciSendCommandA_type)::GetProcAddress(winmm_handle, "mciSendCommandA");
-	mciSendCommandW_orig = (mciSendCommandW_type)::GetProcAddress(winmm_handle, "mciSendCommandW");
-	mciSendStringA_orig = (mciSendStringA_type)::GetProcAddress(winmm_handle, "mciSendStringA");
-	mciSendStringW_orig = (mciSendStringW_type)::GetProcAddress(winmm_handle, "mciSendStringW");
-	mciGetDeviceIDA_orig = (mciGetDeviceIDA_type)::GetProcAddress(winmm_handle, "mciGetDeviceIDA");
-	mciGetDeviceIDW_orig = (mciGetDeviceIDW_type)::GetProcAddress(winmm_handle, "mciGetDeviceIDW");
-	mciGetDeviceIDFromElementIDA_orig = (mciGetDeviceIDFromElementIDA_type)::GetProcAddress(winmm_handle, "mciGetDeviceIDFromElementIDA");
-	mciGetDeviceIDFromElementIDW_orig = (mciGetDeviceIDFromElementIDW_type)::GetProcAddress(winmm_handle, "mciGetDeviceIDFromElementIDW");
-	mciGetDriverData_orig = (mciGetDriverData_type)::GetProcAddress(winmm_handle, "mciGetDriverData");
-	mciGetErrorStringA_orig = (mciGetErrorStringA_type)::GetProcAddress(winmm_handle, "mciGetErrorStringA");
-	mciGetErrorStringW_orig = (mciGetErrorStringW_type)::GetProcAddress(winmm_handle, "mciGetErrorStringW");
-	mciSetDriverData_orig = (mciSetDriverData_type)::GetProcAddress(winmm_handle, "mciSetDriverData");
-	mciSetYieldProc_orig = (mciSetYieldProc_type)::GetProcAddress(winmm_handle, "mciSetYieldProc");
-	mciFreeCommandResource_orig = (mciFreeCommandResource_type)::GetProcAddress(winmm_handle, "mciFreeCommandResource");
-	mciGetCreatorTask_orig = (mciGetCreatorTask_type)::GetProcAddress(winmm_handle, "mciGetCreatorTask");
-	mciGetYieldProc_orig = (mciGetYieldProc_type)::GetProcAddress(winmm_handle, "mciGetYieldProc");
-	mciLoadCommandResource_orig = (mciLoadCommandResource_type)::GetProcAddress(winmm_handle, "mciLoadCommandResource");
-	mciExecute_orig = (mciExecute_type)::GetProcAddress(winmm_handle, "mciExecute");
-}
-
-extern "C" {
-	LRESULT   WINAPI CloseDriver( HDRVR hDriver, LPARAM lParam1, LPARAM lParam2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"CloseDriver\n");
-		return CloseDriver_orig( hDriver, lParam1, lParam2);
-	}
-
-	HDRVR     WINAPI OpenDriver( LPCWSTR szDriverName, LPCWSTR szSectionName, LPARAM lParam2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"OpenDriver\n");
-		return OpenDriver_orig( szDriverName, szSectionName, lParam2);
-	}
-
-	LRESULT   WINAPI SendDriverMessage( HDRVR hDriver, UINT message, LPARAM lParam1, LPARAM lParam2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"SendDriverMessage\n");
-		return SendDriverMessage_orig( hDriver, message, lParam1, lParam2);
-	}
-
-	HMODULE   WINAPI DrvGetModuleHandle( HDRVR hDriver)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"DrvGetModuleHandle\n");
-		return DrvGetModuleHandle_orig( hDriver);
-	}
-
-	HMODULE   WINAPI GetDriverModuleHandle( HDRVR hDriver)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"GetDriverModuleHandle\n");
-		return GetDriverModuleHandle_orig( hDriver);
-	}
-
-	LRESULT   WINAPI DefDriverProc( DWORD_PTR dwDriverIdentifier, HDRVR hdrvr, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"DefDriverProc\n");
-		return DefDriverProc_orig( dwDriverIdentifier, hdrvr, uMsg, lParam1, lParam2);
-	}
-
-	BOOL WINAPI DriverCallback( DWORD_PTR dwCallBack, DWORD dwFlags, HDRVR hdrvr, DWORD msg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"DriverCallback\n");
-		return DriverCallback_orig(dwCallBack, dwFlags, hdrvr, msg, dwUser, dwParam1, dwParam2);
-	}
-
-	UINT WINAPI mmsystemGetVersion(void)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmsystemGetVersion\n");
-		return mmsystemGetVersion_orig();
-	}
-
-	BOOL WINAPI sndPlaySoundA( LPCSTR pszSound, UINT fuSound)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"sndPlaySoundA\n");
-		return sndPlaySoundA_orig( pszSound, fuSound);
-	}
-
-	BOOL WINAPI sndPlaySoundW( LPCWSTR pszSound, UINT fuSound)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"sndPlaySoundW\n");
-		return sndPlaySoundW_orig( pszSound, fuSound);
-	}
-
-	BOOL WINAPI PlaySoundA( LPCSTR pszSound, HMODULE hmod, DWORD fdwSound)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"PlaySoundA\n");
-		return PlaySoundA_orig( pszSound, hmod, fdwSound);
-	}
-
-	BOOL WINAPI PlaySoundW( LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"PlaySoundW\n");
-		return PlaySoundW_orig( pszSound, hmod, fdwSound);
-	}
-
-	UINT WINAPI waveOutGetNumDevs(void)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutGetNumDevs\n");
-		return waveOutGetNumDevs_orig();
-	}
-
-	MMRESULT WINAPI waveOutGetDevCapsA( UINT_PTR uDeviceID, LPWAVEOUTCAPSA pwoc, UINT cbwoc)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutGetDevCapsA\n");
-		return waveOutGetDevCapsA_orig( uDeviceID, pwoc, cbwoc);
-	}
-
-	MMRESULT WINAPI waveOutGetDevCapsW( UINT_PTR uDeviceID, LPWAVEOUTCAPSW pwoc, UINT cbwoc)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutGetDevCapsW\n");
-		return waveOutGetDevCapsW_orig( uDeviceID, pwoc, cbwoc);
-	}
-
-
-	MMRESULT WINAPI waveOutGetVolume( HWAVEOUT hwo, LPDWORD pdwVolume)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutGetVolume\n");
-		return waveOutGetVolume_orig( hwo, pdwVolume);
-	}
-
-	MMRESULT WINAPI waveOutSetVolume( HWAVEOUT hwo, DWORD dwVolume)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutSetVolume\n");
-		return waveOutSetVolume_orig( hwo, dwVolume);
-	}
-
-	MMRESULT WINAPI waveOutGetErrorTextA( MMRESULT mmrError, LPSTR pszText, UINT cchText)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutGetErrorTextA\n");
-		return waveOutGetErrorTextA_orig( mmrError, pszText, cchText);
-	}
-
-	MMRESULT WINAPI waveOutGetErrorTextW( MMRESULT mmrError, LPWSTR pszText, UINT cchText)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutGetErrorTextW\n");
-		return waveOutGetErrorTextW_orig( mmrError, pszText, cchText);
-	}
-
-	//MMRESULT WINAPI waveOutOpen( LPHWAVEOUT phwo, UINT uDeviceID, LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
-	//{
-	//	//OutputDebugString(L"waveOutGetErrorTextW\n");
-	//	return waveOutOpen_orig( phwo, uDeviceID, pwfx, dwCallback, dwInstance, fdwOpen);
-	//}
-
-	//MMRESULT WINAPI waveOutClose( HWAVEOUT hwo)
-	//{
-	//	//OutputDebugString(L"waveOutGetErrorTextW\n");
-	//	return waveOutClose_orig( hwo );
-	//}
-
-	MMRESULT WINAPI waveOutPrepareHeader( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutPrepareHeader\n");
-		return waveOutPrepareHeader_orig( hwo, pwh, cbwh);
-	}
-
-	MMRESULT WINAPI waveOutUnprepareHeader( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutUnprepareHeader\n");
-		return waveOutUnprepareHeader_orig( hwo, pwh, cbwh);
-	}
-
-
-	//MMRESULT WINAPI waveOutWrite( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh)
-	//{
-	//	//OutputDebugString(L"waveOutUnprepareHeader\n");
-	//	return waveOutWrite_orig( hwo, pwh, cbwh);
-	//}
-
-	MMRESULT WINAPI waveOutPause( HWAVEOUT hwo)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutPause\n");
-		return waveOutPause_orig( hwo);
-	}
-
-	MMRESULT WINAPI waveOutRestart( HWAVEOUT hwo)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutRestart\n");
-		return waveOutRestart_orig( hwo);
-	}
-
-	MMRESULT WINAPI waveOutReset( HWAVEOUT hwo)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutReset\n");
-		return waveOutReset_orig( hwo);
-	}
-
-	MMRESULT WINAPI waveOutBreakLoop( HWAVEOUT hwo)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutBreakLoop\n");
-		return waveOutBreakLoop_orig( hwo);
-	}
-
-	MMRESULT WINAPI waveOutGetPosition( HWAVEOUT hwo, LPMMTIME pmmt, UINT cbmmt)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutGetPosition\n");
-		return waveOutGetPosition_orig( hwo, pmmt, cbmmt);
-	}
-
-	MMRESULT WINAPI waveOutGetPitch( HWAVEOUT hwo, LPDWORD pdwPitch)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutGetPitch\n");
-		return waveOutGetPitch_orig( hwo, pdwPitch);
-	}
-
-	MMRESULT WINAPI waveOutSetPitch( HWAVEOUT hwo, DWORD dwPitch)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutSetPitch\n");
-		return waveOutSetPitch_orig( hwo, dwPitch);
-	}
-
-	MMRESULT WINAPI waveOutGetPlaybackRate( HWAVEOUT hwo, LPDWORD pdwRate)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutGetPlaybackRate\n");
-		return waveOutGetPlaybackRate_orig( hwo, pdwRate);
-	}
-
-	MMRESULT WINAPI waveOutSetPlaybackRate( HWAVEOUT hwo, DWORD dwRate)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutSetPlaybackRate\n");
-		return waveOutSetPlaybackRate_orig( hwo, dwRate);
-	}
-
-	MMRESULT WINAPI waveOutGetID( HWAVEOUT hwo, LPUINT puDeviceID)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutGetID\n");
-		return waveOutGetID_orig( hwo, puDeviceID);
-	}
-
-	MMRESULT WINAPI waveOutMessage( HWAVEOUT hwo, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveOutMessage\n");
-		return waveOutMessage_orig( hwo, uMsg, dw1, dw2);
-	}
-
-	UINT WINAPI waveInGetNumDevs(void)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInGetNumDevs\n");
-		return waveInGetNumDevs_orig();
-	}
-
-	MMRESULT WINAPI waveInGetDevCapsA( UINT_PTR uDeviceID, LPWAVEINCAPSA pwic, UINT cbwic)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInGetDevCapsA\n");
-		return waveInGetDevCapsA_orig( uDeviceID, pwic, cbwic);
-	}
-
-	MMRESULT WINAPI waveInGetDevCapsW( UINT_PTR uDeviceID, LPWAVEINCAPSW pwic, UINT cbwic)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInGetDevCapsW\n");
-		return waveInGetDevCapsW_orig( uDeviceID, pwic, cbwic);
-	}
-
-	MMRESULT WINAPI waveInGetErrorTextA(MMRESULT mmrError, LPSTR pszText, UINT cchText)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInGetErrorTextA\n");
-		return waveInGetErrorTextA_orig(mmrError, pszText, cchText);
-	}
-
-	MMRESULT WINAPI waveInGetErrorTextW(MMRESULT mmrError, LPWSTR pszText, UINT cchText)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInGetErrorTextW\n");
-		return waveInGetErrorTextW_orig(mmrError, pszText, cchText);
-	}
-
-	MMRESULT WINAPI waveInOpen( LPHWAVEIN phwi, UINT uDeviceID, LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInOpen\n");
-		return waveInOpen_orig(phwi, uDeviceID, pwfx, dwCallback, dwInstance, fdwOpen);
-	}
-
-	MMRESULT WINAPI waveInClose( HWAVEIN hwi)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInClose\n");
-		return waveInClose_orig( hwi);
-	}
-
-	MMRESULT WINAPI waveInPrepareHeader( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInPrepareHeader\n");
-		return waveInPrepareHeader_orig( hwi, pwh, cbwh);
-	}
-
-	MMRESULT WINAPI waveInUnprepareHeader( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInUnprepareHeader\n");
-		return waveInUnprepareHeader_orig( hwi, pwh, cbwh);
-	}
-
-	MMRESULT WINAPI waveInAddBuffer( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInAddBuffer\n");
-		return waveInAddBuffer_orig( hwi, pwh, cbwh);
-	}
-
-	MMRESULT WINAPI waveInStart( HWAVEIN hwi)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInStart\n");
-		return waveInStart_orig( hwi);
-	}
-
-	MMRESULT WINAPI waveInStop( HWAVEIN hwi)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInStop\n");
-		return waveInStop_orig(hwi);
-	}
-
-	MMRESULT WINAPI waveInReset( HWAVEIN hwi)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInReset\n");
-		return waveInReset_orig(hwi);
-	}
-
-	MMRESULT WINAPI waveInGetPosition( HWAVEIN hwi, LPMMTIME pmmt, UINT cbmmt)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInGetPosition\n");
-		return waveInGetPosition_orig( hwi, pmmt, cbmmt);
-	}
-
-	MMRESULT WINAPI waveInGetID( HWAVEIN hwi, LPUINT puDeviceID)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInGetID\n");
-		return waveInGetID_orig( hwi, puDeviceID);
-	}
-
-	MMRESULT WINAPI waveInMessage( HWAVEIN hwi, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"waveInMessage\n");
-		return waveInMessage_orig( hwi, uMsg, dw1, dw2);
-	}
-
-	UINT WINAPI midiOutGetNumDevs(void)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutGetNumDevs\n");
-		return midiOutGetNumDevs_orig();
-	}
-
-	MMRESULT WINAPI midiStreamOpen( LPHMIDISTRM phms, LPUINT puDeviceID, DWORD cMidi, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiStreamOpen\n");
-		return midiStreamOpen_orig( phms, puDeviceID, cMidi, dwCallback, dwInstance, fdwOpen);
-	}
-
-	MMRESULT WINAPI midiStreamClose( HMIDISTRM hms)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiStreamClose\n");
-		return midiStreamClose_orig( hms);
-	}
-
-	MMRESULT WINAPI midiStreamProperty( HMIDISTRM hms, LPBYTE lppropdata, DWORD dwProperty)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiStreamProperty\n");
-		return midiStreamProperty_orig( hms, lppropdata, dwProperty);
-	}
-
-	MMRESULT WINAPI midiStreamPosition( HMIDISTRM hms, LPMMTIME lpmmt, UINT cbmmt)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiStreamPosition\n");
-		return midiStreamPosition_orig( hms, lpmmt, cbmmt);
-	}
-
-	MMRESULT WINAPI midiStreamOut( HMIDISTRM hms, LPMIDIHDR pmh, UINT cbmh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiStreamOut\n");
-		return midiStreamOut_orig( hms, pmh, cbmh);
-	}
-
-	MMRESULT WINAPI midiStreamPause( HMIDISTRM hms)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiStreamPause\n");
-		return midiStreamPause_orig( hms);
-	}
-
-	MMRESULT WINAPI midiStreamRestart( HMIDISTRM hms)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiStreamRestart\n");
-		return midiStreamRestart_orig( hms);
-	}
-
-	MMRESULT WINAPI midiStreamStop( HMIDISTRM hms)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiStreamStop\n");
-		return midiStreamStop_orig( hms);
-	}
-
-	MMRESULT WINAPI midiConnect( HMIDI hmi, HMIDIOUT hmo, LPVOID pReserved)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiConnect\n");
-		return midiConnect_orig( hmi, hmo, pReserved);
-	}
-
-	MMRESULT WINAPI midiDisconnect( HMIDI hmi, HMIDIOUT hmo, LPVOID pReserved)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiDisconnect\n");
-		return midiDisconnect_orig( hmi, hmo, pReserved);
-	}
-
-	MMRESULT WINAPI midiOutGetDevCapsA( UINT_PTR uDeviceID, LPMIDIOUTCAPSA pmoc, UINT cbmoc)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutGetDevCapsA\n");
-		return midiOutGetDevCapsA_orig( uDeviceID, pmoc, cbmoc);
-	}
-
-	MMRESULT WINAPI midiOutGetDevCapsW( UINT_PTR uDeviceID, LPMIDIOUTCAPSW pmoc, UINT cbmoc)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutGetDevCapsW\n");
-		return midiOutGetDevCapsW_orig( uDeviceID, pmoc, cbmoc);
-	}
-
-	MMRESULT WINAPI midiOutGetVolume( HMIDIOUT hmo, LPDWORD pdwVolume)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutGetVolume\n");
-		return midiOutGetVolume_orig( hmo, pdwVolume);
-	}
-
-	MMRESULT WINAPI midiOutSetVolume( HMIDIOUT hmo, DWORD dwVolume)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutSetVolume\n");
-		return midiOutSetVolume_orig( hmo, dwVolume);
-	}
-
-	MMRESULT WINAPI midiOutGetErrorTextA( MMRESULT mmrError, LPSTR pszText, UINT cchText)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutGetErrorTextA\n");
-		return midiOutGetErrorTextA_orig( mmrError, pszText, cchText);
-	}
-
-	MMRESULT WINAPI midiOutGetErrorTextW( MMRESULT mmrError, LPWSTR pszText, UINT cchText)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutGetErrorTextW\n");
-		return midiOutGetErrorTextW_orig( mmrError, pszText, cchText);
-	}
-
-	MMRESULT WINAPI midiOutOpen( LPHMIDIOUT phmo, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutOpen\n");
-		return midiOutOpen_orig(phmo, uDeviceID, dwCallback, dwInstance, fdwOpen);
-	}
-
-	MMRESULT WINAPI midiOutClose( HMIDIOUT hmo)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutClose\n");
-		return midiOutClose_orig( hmo);
-	}
-
-	MMRESULT WINAPI midiOutPrepareHeader( HMIDIOUT hmo, LPMIDIHDR pmh, UINT cbmh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutPrepareHeader\n");
-		return midiOutPrepareHeader_orig( hmo, pmh, cbmh);
-	}
-
-	MMRESULT WINAPI midiOutUnprepareHeader(HMIDIOUT hmo, LPMIDIHDR pmh, UINT cbmh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutUnprepareHeader\n");
-		return midiOutUnprepareHeader_orig(hmo, pmh, cbmh);
-	}
-
-	MMRESULT WINAPI midiOutShortMsg( HMIDIOUT hmo, DWORD dwMsg)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutShortMsg\n");
-		return midiOutShortMsg_orig( hmo, dwMsg);
-	}
-
-	MMRESULT WINAPI midiOutLongMsg(HMIDIOUT hmo, LPMIDIHDR pmh, UINT cbmh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutLongMsg\n");
-		return midiOutLongMsg_orig(hmo, pmh, cbmh);
-	}
-
-	MMRESULT WINAPI midiOutReset( HMIDIOUT hmo)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutReset\n");
-		return midiOutReset_orig( hmo);
-	}
-
-	MMRESULT WINAPI midiOutCachePatches( HMIDIOUT hmo, UINT uBank, LPWORD pwpa, UINT fuCache)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutCachePatches\n");
-		return midiOutCachePatches_orig( hmo, uBank, pwpa, fuCache);
-	}
-
-	MMRESULT WINAPI midiOutCacheDrumPatches( HMIDIOUT hmo, UINT uPatch, LPWORD pwkya, UINT fuCache)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutCacheDrumPatches\n");
-		return midiOutCacheDrumPatches_orig( hmo, uPatch, pwkya, fuCache);
-	}
-
-	MMRESULT WINAPI midiOutGetID( HMIDIOUT hmo, LPUINT puDeviceID)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutGetID\n");
-		return midiOutGetID_orig( hmo, puDeviceID);
-	}
-
-	MMRESULT WINAPI midiOutMessage( HMIDIOUT hmo, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiOutMessage\n");
-		return midiOutMessage_orig( hmo, uMsg, dw1, dw2);
-	}
-
-	UINT WINAPI midiInGetNumDevs(void)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInGetNumDevs\n");
-		return midiInGetNumDevs_orig();
-	}
-
-	MMRESULT WINAPI midiInGetDevCapsA( UINT_PTR uDeviceID, LPMIDIINCAPSA pmic, UINT cbmic)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInGetDevCapsA\n");
-		return midiInGetDevCapsA_orig( uDeviceID, pmic, cbmic);
-	}
-
-	MMRESULT WINAPI midiInGetDevCapsW( UINT_PTR uDeviceID, LPMIDIINCAPSW pmic, UINT cbmic)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInGetDevCapsW\n");
-		return midiInGetDevCapsW_orig( uDeviceID, pmic, cbmic);
-	}
-
-	MMRESULT WINAPI midiInGetErrorTextA( MMRESULT mmrError, LPSTR pszText, UINT cchText)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInGetErrorTextA\n");
-		return midiInGetErrorTextA_orig( mmrError, pszText, cchText);
-	}
-
-	MMRESULT WINAPI midiInGetErrorTextW( MMRESULT mmrError, LPWSTR pszText, UINT cchText)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInGetErrorTextW\n");
-		return midiInGetErrorTextW_orig( mmrError, pszText, cchText);
-	}
-
-	MMRESULT WINAPI midiInOpen( LPHMIDIIN phmi, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInOpen\n");
-		return midiInOpen_orig(phmi, uDeviceID, dwCallback, dwInstance, fdwOpen);
-	}
-
-	MMRESULT WINAPI midiInClose( HMIDIIN hmi)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInClose\n");
-		return midiInClose_orig( hmi);
-	}
-
-	MMRESULT WINAPI midiInPrepareHeader( HMIDIIN hmi, LPMIDIHDR pmh, UINT cbmh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInPrepareHeader\n");
-		return midiInPrepareHeader_orig( hmi, pmh, cbmh);
-	}
-
-	MMRESULT WINAPI midiInUnprepareHeader( HMIDIIN hmi, LPMIDIHDR pmh, UINT cbmh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInUnprepareHeader\n");
-		return midiInUnprepareHeader_orig( hmi, pmh, cbmh);
-	}
-
-	MMRESULT WINAPI midiInAddBuffer( HMIDIIN hmi, LPMIDIHDR pmh, UINT cbmh)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInAddBuffer\n");
-		return midiInAddBuffer_orig( hmi, pmh, cbmh);
-	}
-
-	MMRESULT WINAPI midiInStart( HMIDIIN hmi)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInStart\n");
-		return midiInStart_orig( hmi);
-	}
-
-	MMRESULT WINAPI midiInStop( HMIDIIN hmi)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInStop\n");
-		return midiInStop_orig(hmi);
-	}
-
-	MMRESULT WINAPI midiInReset( HMIDIIN hmi)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInReset\n");
-		return midiInReset_orig( hmi);
-	}
-
-	MMRESULT WINAPI midiInGetID( HMIDIIN hmi, LPUINT puDeviceID)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInGetID\n");
-		return midiInGetID_orig( hmi, puDeviceID);
-	}
-
-	MMRESULT WINAPI midiInMessage( HMIDIIN hmi, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"midiInMessage\n");
-		return midiInMessage_orig( hmi, uMsg, dw1, dw2);
-	}
-
-	UINT WINAPI auxGetNumDevs(void)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"auxGetNumDevs\n");
-		return auxGetNumDevs_orig();
-	}
-
-	MMRESULT WINAPI auxGetDevCapsA( UINT_PTR uDeviceID, LPAUXCAPSA pac, UINT cbac)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"auxGetDevCapsA\n");
-		return auxGetDevCapsA_orig( uDeviceID, pac, cbac);
-	}
-
-	MMRESULT WINAPI auxGetDevCapsW( UINT_PTR uDeviceID, LPAUXCAPSW pac, UINT cbac)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"auxGetDevCapsW\n");
-		return auxGetDevCapsW_orig( uDeviceID, pac, cbac);
-	}
-
-	MMRESULT WINAPI auxSetVolume( UINT uDeviceID, DWORD dwVolume)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"auxSetVolume\n");
-		return auxSetVolume_orig( uDeviceID, dwVolume);
-	}
-
-	MMRESULT WINAPI auxGetVolume( UINT uDeviceID, LPDWORD pdwVolume)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"auxGetVolume\n");
-		return auxGetVolume_orig( uDeviceID, pdwVolume);
-	}
-
-	MMRESULT WINAPI auxOutMessage( UINT uDeviceID, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"auxOutMessage\n");
-		return auxOutMessage_orig( uDeviceID, uMsg, dw1, dw2);
-	}
-
-	UINT WINAPI mixerGetNumDevs(void)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerGetNumDevs\n");
-		return mixerGetNumDevs_orig();
-	}
-
-	MMRESULT WINAPI mixerGetDevCapsA( UINT_PTR uMxId, LPMIXERCAPSA pmxcaps, UINT cbmxcaps)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerGetDevCapsA\n");
-		return mixerGetDevCapsA_orig( uMxId, pmxcaps, cbmxcaps);
-	}
-
-	MMRESULT WINAPI mixerGetDevCapsW( UINT_PTR uMxId, LPMIXERCAPSW pmxcaps, UINT cbmxcaps)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerGetDevCapsW\n");
-		return mixerGetDevCapsW_orig( uMxId, pmxcaps, cbmxcaps);
-	}
-
-	MMRESULT WINAPI mixerOpen( LPHMIXER phmx, UINT uMxId, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerOpen\n");
-		return mixerOpen_orig( phmx, uMxId, dwCallback, dwInstance, fdwOpen);
-	}
-
-	MMRESULT WINAPI mixerClose( HMIXER hmx)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerClose\n");
-		return mixerClose_orig( hmx);
-	}
-
-	DWORD WINAPI mixerMessage( HMIXER hmx, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerMessage\n");
-		return mixerMessage_orig( hmx, uMsg, dwParam1, dwParam2);
-	}
-
-	MMRESULT WINAPI mixerGetLineInfoA( HMIXEROBJ hmxobj, LPMIXERLINEA pmxl, DWORD fdwInfo)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerGetLineInfoA\n");
-		return mixerGetLineInfoA_orig( hmxobj, pmxl, fdwInfo);
-	}
-
-	MMRESULT WINAPI mixerGetLineInfoW( HMIXEROBJ hmxobj, LPMIXERLINEW pmxl, DWORD fdwInfo)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerGetLineInfoW\n");
-		return mixerGetLineInfoW_orig( hmxobj, pmxl, fdwInfo);
-	}
-
-	MMRESULT WINAPI mixerGetID( HMIXEROBJ hmxobj, UINT FAR *puMxId, DWORD fdwId)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerGetID\n");
-		return mixerGetID_orig( hmxobj, puMxId, fdwId);
-	}
-
-	MMRESULT WINAPI mixerGetLineControlsA( HMIXEROBJ hmxobj, LPMIXERLINECONTROLSA pmxlc, DWORD fdwControls)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerGetLineControlsA\n");
-		return mixerGetLineControlsA_orig( hmxobj, pmxlc, fdwControls);
-	}
-
-	MMRESULT WINAPI mixerGetLineControlsW( HMIXEROBJ hmxobj, LPMIXERLINECONTROLSW pmxlc, DWORD fdwControls)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerGetLineControlsW\n");
-		return mixerGetLineControlsW_orig( hmxobj, pmxlc, fdwControls);
-	}
-
-	MMRESULT WINAPI mixerGetControlDetailsA( HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerGetControlDetailsA\n");
-		return mixerGetControlDetailsA_orig( hmxobj, pmxcd, fdwDetails);
-	}
-
-	MMRESULT WINAPI mixerGetControlDetailsW( HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerGetControlDetailsW\n");
-		return mixerGetControlDetailsW_orig( hmxobj, pmxcd, fdwDetails);
-	}
-
-	MMRESULT WINAPI mixerSetControlDetails( HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mixerSetControlDetails\n");
-		return mixerSetControlDetails_orig( hmxobj, pmxcd, fdwDetails);
-	}
-
-	DWORD    WINAPI mmGetCurrentTask(void)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmGetCurrentTask\n");
-		return mmGetCurrentTask_orig();
-	}
-
-	void WINAPI mmTaskBlock(DWORD val)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmTaskBlock\n");
-		return mmTaskBlock_orig(val);
-	}
-
-	UINT WINAPI mmTaskCreate(LPTASKCALLBACK a, HANDLE* b, DWORD_PTR c)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmTaskCreate\n");
-		return mmTaskCreate_orig(a, b, c);
-	}
-
-	BOOL WINAPI mmTaskSignal(DWORD a)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmTaskSignal\n");
-		return mmTaskSignal_orig(a);
-	}
-
-	VOID WINAPI mmTaskYield()
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmTaskYield\n");
-		mmTaskYield_orig();
-	}
-
-	MMRESULT WINAPI timeGetSystemTime( LPMMTIME pmmt, UINT cbmmt)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"timeGetSystemTime\n");
-		return timeGetSystemTime_orig( pmmt, cbmmt);
-	}
-
-	DWORD WINAPI timeGetTime(void)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"timeGetTime\n");
-		return timeGetTime_orig();
-	}
-
-	MMRESULT WINAPI timeSetEvent( UINT uDelay, UINT uResolution, LPTIMECALLBACK fptc, DWORD_PTR dwUser, UINT fuEvent)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"timeSetEvent\n");
-		return timeSetEvent_orig(uDelay, uResolution, fptc, dwUser, fuEvent);
-	}
-
-	MMRESULT WINAPI timeKillEvent( UINT uTimerID)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"timeKillEvent\n");
-		return timeKillEvent_orig( uTimerID);
-	}
-
-	MMRESULT WINAPI timeGetDevCaps( LPTIMECAPS ptc, UINT cbtc)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"timeGetDevCaps\n");
-		return timeGetDevCaps_orig( ptc, cbtc);
-	}
-
-	MMRESULT WINAPI timeBeginPeriod( UINT uPeriod)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"timeBeginPeriod\n");
-		return timeBeginPeriod_orig( uPeriod);
-	}
-
-	MMRESULT WINAPI timeEndPeriod( UINT uPeriod)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"timeEndPeriod\n");
-		return timeEndPeriod_orig( uPeriod);
-	}
-
-	UINT WINAPI joyGetNumDevs(void)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"joyGetNumDevs\n");
-		return joyGetNumDevs_orig();
-	}
-
-	MMRESULT WINAPI joyConfigChanged(DWORD dwFlags)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"joyConfigChanged\n");
-		return joyConfigChanged_orig(dwFlags);
-	}
-
-	MMRESULT WINAPI joyGetDevCapsA( UINT_PTR uJoyID, LPJOYCAPSA pjc, UINT cbjc)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"joyGetDevCapsA\n");
-		return joyGetDevCapsA_orig( uJoyID, pjc, cbjc);
-	}
-
-	MMRESULT WINAPI joyGetDevCapsW( UINT_PTR uJoyID, LPJOYCAPSW pjc, UINT cbjc)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"joyGetDevCapsW\n");
-		return joyGetDevCapsW_orig( uJoyID, pjc, cbjc);
-	}
-
-	MMRESULT WINAPI joyGetPos( UINT uJoyID, LPJOYINFO pji)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"joyGetPos\n");
-		return joyGetPos_orig( uJoyID, pji);
-	}
-
-	MMRESULT WINAPI joyGetPosEx( UINT uJoyID, LPJOYINFOEX pji)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"joyGetPosEx\n");
-		return joyGetPosEx_orig( uJoyID, pji);
-	}
-
-	MMRESULT WINAPI joyGetThreshold( UINT uJoyID, LPUINT puThreshold)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"joyGetThreshold\n");
-		return joyGetThreshold_orig( uJoyID, puThreshold);
-	}
-
-	MMRESULT WINAPI joyReleaseCapture( UINT uJoyID)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"joyReleaseCapture\n");
-		return joyReleaseCapture_orig( uJoyID);
-	}
-
-	MMRESULT WINAPI joySetCapture( HWND hwnd, UINT uJoyID, UINT uPeriod, BOOL fChanged)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"joySetCapture\n");
-		return joySetCapture_orig(hwnd, uJoyID, uPeriod, fChanged);
-	}
-
-	MMRESULT WINAPI joySetThreshold( UINT uJoyID, UINT uThreshold)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"joySetThreshold\n");
-		return joySetThreshold_orig( uJoyID, uThreshold);
-	}
-
-	BOOL WINAPI mciDriverNotify(HANDLE hwndCallback, MCIDEVICEID uDeviceID, UINT uStatus)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciDriverNotify\n");
-		return mciDriverNotify_orig(hwndCallback, uDeviceID, uStatus);
-	}
-
-	UINT WINAPI  mciDriverYield(UINT uDeviceID)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciDriverYield\n");
-		return mciDriverYield_orig(uDeviceID);
-	}	
-
-	FOURCC WINAPI mmioStringToFOURCCA( LPCSTR sz, UINT uFlags)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioStringToFOURCCA\n");
-		return mmioStringToFOURCCA_orig( sz, uFlags);
-	}
-
-	FOURCC WINAPI mmioStringToFOURCCW( LPCWSTR sz, UINT uFlags)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioStringToFOURCCW\n");
-		return mmioStringToFOURCCW_orig( sz, uFlags);
-	}
-
-	LPMMIOPROC WINAPI mmioInstallIOProcA( FOURCC fccIOProc, LPMMIOPROC pIOProc, DWORD dwFlags)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioInstallIOProcA\n");
-		return mmioInstallIOProcA_orig( fccIOProc, pIOProc, dwFlags);
-	}
-
-	LPMMIOPROC WINAPI mmioInstallIOProcW( FOURCC fccIOProc, LPMMIOPROC pIOProc, DWORD dwFlags)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioInstallIOProcW\n");
-		return mmioInstallIOProcW_orig( fccIOProc, pIOProc, dwFlags);
-	}
-
-	HMMIO WINAPI mmioOpenA( LPSTR pszFileName, LPMMIOINFO pmmioinfo, DWORD fdwOpen)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioOpenA\n");
-		return mmioOpenA_orig( pszFileName, pmmioinfo, fdwOpen);
-	}
-
-	HMMIO WINAPI mmioOpenW( LPWSTR pszFileName, LPMMIOINFO pmmioinfo, DWORD fdwOpen)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioOpenW\n");
-		return mmioOpenW_orig( pszFileName, pmmioinfo, fdwOpen);
-	}
-
-	MMRESULT WINAPI mmioRenameA( LPCSTR pszFileName, LPCSTR pszNewFileName, LPCMMIOINFO pmmioinfo, DWORD fdwRename)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioRenameA\n");
-		return mmioRenameA_orig( pszFileName, pszNewFileName, pmmioinfo, fdwRename);
-	}
-
-	MMRESULT WINAPI mmioRenameW( LPCWSTR pszFileName, LPCWSTR pszNewFileName, LPCMMIOINFO pmmioinfo, DWORD fdwRename)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioRenameW\n");
-		return mmioRenameW_orig( pszFileName, pszNewFileName, pmmioinfo, fdwRename);
-	}
-
-	MMRESULT WINAPI mmioClose( HMMIO hmmio, UINT fuClose)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioClose\n");
-		return mmioClose_orig( hmmio, fuClose);
-	}
-
-	LONG WINAPI mmioRead( HMMIO hmmio, HPSTR pch, LONG cch)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioRead\n");
-		return mmioRead_orig( hmmio, pch, cch);
-	}
-
-	LONG WINAPI mmioWrite( HMMIO hmmio, const char _huge* pch, LONG cch)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioWrite\n");
-		return mmioWrite_orig( hmmio, pch, cch);
-	}
-
-	LONG WINAPI mmioSeek( HMMIO hmmio, LONG lOffset, int iOrigin)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioSeek\n");
-		return mmioSeek_orig(hmmio, lOffset, iOrigin);
-	}
-
-	MMRESULT WINAPI mmioGetInfo( HMMIO hmmio, LPMMIOINFO pmmioinfo, UINT fuInfo)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioGetInfo\n");
-		return mmioGetInfo_orig( hmmio, pmmioinfo, fuInfo);
-	}
-
-	MMRESULT WINAPI mmioSetInfo( HMMIO hmmio, LPCMMIOINFO pmmioinfo, UINT fuInfo)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioSetInfo\n");
-		return mmioSetInfo_orig( hmmio, pmmioinfo, fuInfo);
-	}
-
-	MMRESULT WINAPI mmioSetBuffer( HMMIO hmmio, LPSTR pchBuffer, LONG cchBuffer, UINT fuBuffer)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioSetBuffer\n");
-		return mmioSetBuffer_orig(hmmio, pchBuffer, cchBuffer, fuBuffer);
-	}
-
-	MMRESULT WINAPI mmioFlush( HMMIO hmmio, UINT fuFlush)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioFlush\n");
-		return mmioFlush_orig( hmmio, fuFlush);
-	}
-
-	MMRESULT WINAPI mmioAdvance( HMMIO hmmio, LPMMIOINFO pmmioinfo, UINT fuAdvance)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioAdvance\n");
-		return mmioAdvance_orig( hmmio, pmmioinfo, fuAdvance);
-	}
-
-	LRESULT WINAPI mmioSendMessage( HMMIO hmmio, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioSendMessage\n");
-		return mmioSendMessage_orig(hmmio, uMsg, lParam1, lParam2);
-	}
-
-	MMRESULT WINAPI mmioDescend( HMMIO hmmio, LPMMCKINFO pmmcki, const MMCKINFO FAR* pmmckiParent, UINT fuDescend)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioDescend\n");
-		return mmioDescend_orig(hmmio, pmmcki, pmmckiParent, fuDescend);
-	}
-
-	MMRESULT WINAPI mmioAscend( HMMIO hmmio, LPMMCKINFO pmmcki, UINT fuAscend)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioAscend\n");
-		return mmioAscend_orig( hmmio, pmmcki, fuAscend);
-	}
-
-	MMRESULT WINAPI mmioCreateChunk(HMMIO hmmio, LPMMCKINFO pmmcki, UINT fuCreate)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mmioCreateChunk\n");
-		return mmioCreateChunk_orig(hmmio, pmmcki, fuCreate);
-	}
-
-	MCIERROR WINAPI mciSendCommandA( MCIDEVICEID mciId, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciSendCommandA\n");
-		return mciSendCommandA_orig( mciId, uMsg, dwParam1, dwParam2);
-	}
-
-	MCIERROR WINAPI mciSendCommandW( MCIDEVICEID mciId, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciSendCommandW\n");
-		return mciSendCommandW_orig( mciId, uMsg, dwParam1, dwParam2);
-	}
-
-	MCIERROR  WINAPI mciSendStringA( LPCSTR lpstrCommand, LPSTR lpstrReturnString, UINT uReturnLength, HWND hwndCallback)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciSendStringA\n");
-		return mciSendStringA_orig( lpstrCommand, lpstrReturnString, uReturnLength, hwndCallback);
-	}
-
-	MCIERROR  WINAPI mciSendStringW( LPCWSTR lpstrCommand, LPWSTR lpstrReturnString, UINT uReturnLength, HWND hwndCallback)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciSendStringW\n");
-		return mciSendStringW_orig( lpstrCommand, lpstrReturnString, uReturnLength, hwndCallback);
-	}
-
-	MCIDEVICEID WINAPI mciGetDeviceIDA( LPCSTR pszDevice)
-	{
-		//OutputDebugString(L"mciGetDeviceIDA\n");
-		return mciGetDeviceIDA_orig( pszDevice);
-	}
-
-	MCIDEVICEID WINAPI mciGetDeviceIDW( LPCWSTR pszDevice)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciGetDeviceIDW\n");
-		return mciGetDeviceIDW_orig( pszDevice);
-	}
-
-	MCIDEVICEID WINAPI mciGetDeviceIDFromElementIDA( DWORD dwElementID, LPCSTR lpstrType )
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciGetDeviceIDFromElementIDA\n");
-		return mciGetDeviceIDFromElementIDA_orig( dwElementID, lpstrType );
-	}
-
-	MCIDEVICEID WINAPI mciGetDeviceIDFromElementIDW( DWORD dwElementID, LPCWSTR lpstrType )
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciGetDeviceIDFromElementIDW\n");
-		return mciGetDeviceIDFromElementIDW_orig( dwElementID, lpstrType );
-	}
-
-	DWORD_PTR WINAPI  mciGetDriverData(UINT uDeviceID)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciGetDriverData\n");
-		return mciGetDriverData_orig(uDeviceID);
-	}
-
-	BOOL WINAPI mciGetErrorStringA( MCIERROR mcierr, LPSTR pszText, UINT cchText)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciGetErrorStringA\n");
-		return mciGetErrorStringA_orig( mcierr, pszText, cchText);
-	}
-
-	BOOL WINAPI mciGetErrorStringW( MCIERROR mcierr, LPWSTR pszText, UINT cchText)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciGetErrorStringW\n");
-		return mciGetErrorStringW_orig( mcierr, pszText, cchText);
-	}
-
-	BOOL WINAPI  mciSetDriverData(UINT uDeviceID, DWORD_PTR dwData)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciSetDriverData_type\n");
-		return mciSetDriverData_orig( uDeviceID, dwData );
-	}
-
-	BOOL WINAPI mciSetYieldProc( MCIDEVICEID mciId, YIELDPROC fpYieldProc, DWORD dwYieldData)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciSetYieldProc\n");
-		return mciSetYieldProc_orig(mciId, fpYieldProc, dwYieldData);
-	}
-
-	BOOL WINAPI  mciFreeCommandResource(UINT uTable)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciFreeCommandResource\n");
-		return mciFreeCommandResource_orig(uTable);
-	}
-
-	HTASK WINAPI mciGetCreatorTask( MCIDEVICEID mciId)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciGetCreatorTask\n");
-		return mciGetCreatorTask_orig( mciId);
-	}
-
-	YIELDPROC WINAPI mciGetYieldProc( MCIDEVICEID mciId, LPDWORD pdwYieldData)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciGetYieldProc\n");
-		return mciGetYieldProc_orig( mciId, pdwYieldData);
-	}
-
-	UINT WINAPI mciLoadCommandResource(HANDLE hInstance, LPCWSTR lpResName, UINT uType)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciLoadCommandResource");
-		return mciLoadCommandResource_orig(hInstance, lpResName, uType);
-	}
-	
-
-	BOOL WINAPI mciExecute(LPCSTR pszCommand)
-	{
-		ll_winmm_shim_initialize();
-		//OutputDebugString(L"mciExecute\n");
-		return mciExecute_orig(pszCommand);
-	}
-}
diff --git a/indra/media_plugins/winmmshim/forwarding_api.h b/indra/media_plugins/winmmshim/forwarding_api.h
deleted file mode 100644
index 1418fc9e1d..0000000000
--- a/indra/media_plugins/winmmshim/forwarding_api.h
+++ /dev/null
@@ -1,390 +0,0 @@
-/** 
- * @file forwarding_api.h
- * @brief forwards winmm API calls to real winmm.dll
- *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-// this turns off __declspec(dllimport) for the functions declared in mmsystem.h
-#define _WINMM_
-#include <windows.h>
-#include <mmsystem.h>
-
-void init_function_pointers(HMODULE winmm_handle);
-void ll_winmm_shim_initialize();
-
-typedef VOID (*LPTASKCALLBACK)(DWORD_PTR dwInst);
-
-typedef LRESULT   (WINAPI *CloseDriver_type)( HDRVR hDriver, LPARAM lParam1, LPARAM lParam2);
-extern CloseDriver_type CloseDriver_orig;
-typedef HDRVR     (WINAPI *OpenDriver_type)( LPCWSTR szDriverName, LPCWSTR szSectionName, LPARAM lParam2);
-extern OpenDriver_type OpenDriver_orig;
-typedef LRESULT   (WINAPI *SendDriverMessage_type)( HDRVR hDriver, UINT message, LPARAM lParam1, LPARAM lParam2);
-extern SendDriverMessage_type SendDriverMessage_orig;
-typedef HMODULE   (WINAPI *DrvGetModuleHandle_type)( HDRVR hDriver);
-extern DrvGetModuleHandle_type DrvGetModuleHandle_orig;
-typedef HMODULE   (WINAPI *GetDriverModuleHandle_type)( HDRVR hDriver);
-extern GetDriverModuleHandle_type GetDriverModuleHandle_orig;
-typedef LRESULT   (WINAPI *DefDriverProc_type)( DWORD_PTR dwDriverIdentifier, HDRVR hdrvr, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
-extern DefDriverProc_type DefDriverProc_orig;
-typedef BOOL (WINAPI *DriverCallback_type)(DWORD dwCallBack, DWORD dwFlags, HDRVR hdrvr, DWORD msg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
-extern DriverCallback_type DriverCallback_orig;
-typedef UINT (WINAPI *mmsystemGetVersion_type)(void);
-extern mmsystemGetVersion_type mmsystemGetVersion_orig;
-typedef BOOL (WINAPI *sndPlaySoundA_type)( LPCSTR pszSound, UINT fuSound);
-extern sndPlaySoundA_type sndPlaySoundA_orig;
-typedef BOOL (WINAPI *sndPlaySoundW_type)( LPCWSTR pszSound, UINT fuSound);
-extern sndPlaySoundW_type sndPlaySoundW_orig;
-typedef BOOL (WINAPI *PlaySoundA_type)( LPCSTR pszSound, HMODULE hmod, DWORD fdwSound);
-extern PlaySoundA_type PlaySoundA_orig;
-typedef BOOL (WINAPI *PlaySoundW_type)( LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound);
-extern PlaySoundW_type PlaySoundW_orig;
-typedef UINT (WINAPI *waveOutGetNumDevs_type)(void);
-extern waveOutGetNumDevs_type waveOutGetNumDevs_orig;
-typedef MMRESULT (WINAPI *waveOutGetDevCapsA_type)( UINT_PTR uDeviceID, LPWAVEOUTCAPSA pwoc, UINT cbwoc);
-extern waveOutGetDevCapsA_type waveOutGetDevCapsA_orig;
-typedef MMRESULT (WINAPI *waveOutGetDevCapsW_type)( UINT_PTR uDeviceID, LPWAVEOUTCAPSW pwoc, UINT cbwoc);
-extern waveOutGetDevCapsW_type waveOutGetDevCapsW_orig;
-typedef MMRESULT (WINAPI *waveOutGetVolume_type)( HWAVEOUT hwo, LPDWORD pdwVolume);
-extern waveOutGetVolume_type waveOutGetVolume_orig;
-typedef MMRESULT (WINAPI *waveOutSetVolume_type)( HWAVEOUT hwo, DWORD dwVolume);
-extern waveOutSetVolume_type waveOutSetVolume_orig;
-typedef MMRESULT (WINAPI *waveOutGetErrorTextA_type)( MMRESULT mmrError, LPSTR pszText, UINT cchText);
-extern waveOutGetErrorTextA_type waveOutGetErrorTextA_orig;
-typedef MMRESULT (WINAPI *waveOutGetErrorTextW_type)( MMRESULT mmrError, LPWSTR pszText, UINT cchText);
-extern waveOutGetErrorTextW_type waveOutGetErrorTextW_orig;
-typedef MMRESULT (WINAPI *waveOutOpen_type)( LPHWAVEOUT phwo, UINT uDeviceID, LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
-extern waveOutOpen_type waveOutOpen_orig;
-typedef MMRESULT (WINAPI *waveOutClose_type)( HWAVEOUT hwo);
-extern waveOutClose_type waveOutClose_orig;
-typedef MMRESULT (WINAPI *waveOutPrepareHeader_type)( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
-extern waveOutPrepareHeader_type waveOutPrepareHeader_orig;
-typedef MMRESULT (WINAPI *waveOutUnprepareHeader_type)( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
-extern waveOutUnprepareHeader_type waveOutUnprepareHeader_orig;
-typedef MMRESULT (WINAPI *waveOutWrite_type)( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh);
-extern waveOutWrite_type waveOutWrite_orig;
-typedef MMRESULT (WINAPI *waveOutPause_type)( HWAVEOUT hwo);
-extern waveOutPause_type waveOutPause_orig;
-typedef MMRESULT (WINAPI *waveOutRestart_type)( HWAVEOUT hwo);
-extern waveOutRestart_type waveOutRestart_orig;
-typedef MMRESULT (WINAPI *waveOutReset_type)( HWAVEOUT hwo);
-extern waveOutReset_type waveOutReset_orig;
-typedef MMRESULT (WINAPI *waveOutBreakLoop_type)( HWAVEOUT hwo);
-extern waveOutBreakLoop_type waveOutBreakLoop_orig;
-typedef MMRESULT (WINAPI *waveOutGetPosition_type)( HWAVEOUT hwo, LPMMTIME pmmt, UINT cbmmt);
-extern waveOutGetPosition_type waveOutGetPosition_orig;
-typedef MMRESULT (WINAPI *waveOutGetPitch_type)( HWAVEOUT hwo, LPDWORD pdwPitch);
-extern waveOutGetPitch_type waveOutGetPitch_orig;
-typedef MMRESULT (WINAPI *waveOutSetPitch_type)( HWAVEOUT hwo, DWORD dwPitch);
-extern waveOutSetPitch_type waveOutSetPitch_orig;
-typedef MMRESULT (WINAPI *waveOutGetPlaybackRate_type)( HWAVEOUT hwo, LPDWORD pdwRate);
-extern waveOutGetPlaybackRate_type waveOutGetPlaybackRate_orig;
-typedef MMRESULT (WINAPI *waveOutSetPlaybackRate_type)( HWAVEOUT hwo, DWORD dwRate);
-extern waveOutSetPlaybackRate_type waveOutSetPlaybackRate_orig;
-typedef MMRESULT (WINAPI *waveOutGetID_type)( HWAVEOUT hwo, LPUINT puDeviceID);
-extern waveOutGetID_type waveOutGetID_orig;
-typedef MMRESULT (WINAPI *waveOutMessage_type)( HWAVEOUT hwo, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
-extern waveOutMessage_type waveOutMessage_orig;
-typedef UINT (WINAPI *waveInGetNumDevs_type)(void);
-extern waveInGetNumDevs_type waveInGetNumDevs_orig;
-typedef MMRESULT (WINAPI *waveInGetDevCapsA_type)( UINT_PTR uDeviceID, LPWAVEINCAPSA pwic, UINT cbwic);
-extern waveInGetDevCapsA_type waveInGetDevCapsA_orig;
-typedef MMRESULT (WINAPI *waveInGetDevCapsW_type)( UINT_PTR uDeviceID, LPWAVEINCAPSW pwic, UINT cbwic);
-extern waveInGetDevCapsW_type waveInGetDevCapsW_orig;
-typedef MMRESULT (WINAPI *waveInGetErrorTextA_type)(MMRESULT mmrError, LPSTR pszText, UINT cchText);
-extern waveInGetErrorTextA_type waveInGetErrorTextA_orig;
-typedef MMRESULT (WINAPI *waveInGetErrorTextW_type)(MMRESULT mmrError, LPWSTR pszText, UINT cchText);
-extern waveInGetErrorTextW_type waveInGetErrorTextW_orig;
-typedef MMRESULT (WINAPI *waveInOpen_type)( LPHWAVEIN phwi, UINT uDeviceID, LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
-extern waveInOpen_type waveInOpen_orig;
-typedef MMRESULT (WINAPI *waveInClose_type)( HWAVEIN hwi);
-extern waveInClose_type waveInClose_orig;
-typedef MMRESULT (WINAPI *waveInPrepareHeader_type)( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
-extern waveInPrepareHeader_type waveInPrepareHeader_orig;
-typedef MMRESULT (WINAPI *waveInUnprepareHeader_type)( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
-extern waveInUnprepareHeader_type waveInUnprepareHeader_orig;
-typedef MMRESULT (WINAPI *waveInAddBuffer_type)( HWAVEIN hwi, LPWAVEHDR pwh, UINT cbwh);
-extern waveInAddBuffer_type waveInAddBuffer_orig;
-typedef MMRESULT (WINAPI *waveInStart_type)( HWAVEIN hwi);
-extern waveInStart_type waveInStart_orig;
-typedef MMRESULT (WINAPI *waveInStop_type)( HWAVEIN hwi);
-extern waveInStop_type waveInStop_orig;
-typedef MMRESULT (WINAPI *waveInReset_type)( HWAVEIN hwi);
-extern waveInReset_type waveInReset_orig;
-typedef MMRESULT (WINAPI *waveInGetPosition_type)( HWAVEIN hwi, LPMMTIME pmmt, UINT cbmmt);
-extern waveInGetPosition_type waveInGetPosition_orig;
-typedef MMRESULT (WINAPI *waveInGetID_type)( HWAVEIN hwi, LPUINT puDeviceID);
-extern waveInGetID_type waveInGetID_orig;
-typedef MMRESULT (WINAPI *waveInMessage_type)( HWAVEIN hwi, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
-extern waveInMessage_type waveInMessage_orig;
-typedef UINT (WINAPI *midiOutGetNumDevs_type)(void);
-extern midiOutGetNumDevs_type midiOutGetNumDevs_orig;
-typedef MMRESULT (WINAPI *midiStreamOpen_type)( LPHMIDISTRM phms, LPUINT puDeviceID, DWORD cMidi, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
-extern midiStreamOpen_type midiStreamOpen_orig;
-typedef MMRESULT (WINAPI *midiStreamClose_type)( HMIDISTRM hms);
-extern midiStreamClose_type midiStreamClose_orig;
-typedef MMRESULT (WINAPI *midiStreamProperty_type)( HMIDISTRM hms, LPBYTE lppropdata, DWORD dwProperty);
-extern midiStreamProperty_type midiStreamProperty_orig;
-typedef MMRESULT (WINAPI *midiStreamPosition_type)( HMIDISTRM hms, LPMMTIME lpmmt, UINT cbmmt);
-extern midiStreamPosition_type midiStreamPosition_orig;
-typedef MMRESULT (WINAPI *midiStreamOut_type)( HMIDISTRM hms, LPMIDIHDR pmh, UINT cbmh);
-extern midiStreamOut_type midiStreamOut_orig;
-typedef MMRESULT (WINAPI *midiStreamPause_type)( HMIDISTRM hms);
-extern midiStreamPause_type midiStreamPause_orig;
-typedef MMRESULT (WINAPI *midiStreamRestart_type)( HMIDISTRM hms);
-extern midiStreamRestart_type midiStreamRestart_orig;
-typedef MMRESULT (WINAPI *midiStreamStop_type)( HMIDISTRM hms);
-extern midiStreamStop_type midiStreamStop_orig;
-typedef MMRESULT (WINAPI *midiConnect_type)( HMIDI hmi, HMIDIOUT hmo, LPVOID pReserved);
-extern midiConnect_type midiConnect_orig;
-typedef MMRESULT (WINAPI *midiDisconnect_type)( HMIDI hmi, HMIDIOUT hmo, LPVOID pReserved);
-extern midiDisconnect_type midiDisconnect_orig;
-typedef MMRESULT (WINAPI *midiOutGetDevCapsA_type)( UINT_PTR uDeviceID, LPMIDIOUTCAPSA pmoc, UINT cbmoc);
-extern midiOutGetDevCapsA_type midiOutGetDevCapsA_orig;
-typedef MMRESULT (WINAPI *midiOutGetDevCapsW_type)( UINT_PTR uDeviceID, LPMIDIOUTCAPSW pmoc, UINT cbmoc);
-extern midiOutGetDevCapsW_type midiOutGetDevCapsW_orig;
-typedef MMRESULT (WINAPI *midiOutGetVolume_type)( HMIDIOUT hmo, LPDWORD pdwVolume);
-extern midiOutGetVolume_type midiOutGetVolume_orig;
-typedef MMRESULT (WINAPI *midiOutSetVolume_type)( HMIDIOUT hmo, DWORD dwVolume);
-extern midiOutSetVolume_type midiOutSetVolume_orig;
-typedef MMRESULT (WINAPI *midiOutGetErrorTextA_type)( MMRESULT mmrError, LPSTR pszText, UINT cchText);
-extern midiOutGetErrorTextA_type midiOutGetErrorTextA_orig;
-typedef MMRESULT (WINAPI *midiOutGetErrorTextW_type)( MMRESULT mmrError, LPWSTR pszText, UINT cchText);
-extern midiOutGetErrorTextW_type midiOutGetErrorTextW_orig;
-typedef MMRESULT (WINAPI *midiOutOpen_type)( LPHMIDIOUT phmo, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
-extern midiOutOpen_type midiOutOpen_orig;
-typedef MMRESULT (WINAPI *midiOutClose_type)( HMIDIOUT hmo);
-extern midiOutClose_type midiOutClose_orig;
-typedef MMRESULT (WINAPI *midiOutPrepareHeader_type)( HMIDIOUT hmo, LPMIDIHDR pmh, UINT cbmh);
-extern midiOutPrepareHeader_type midiOutPrepareHeader_orig;
-typedef MMRESULT (WINAPI *midiOutUnprepareHeader_type)(HMIDIOUT hmo, LPMIDIHDR pmh, UINT cbmh);
-extern midiOutUnprepareHeader_type midiOutUnprepareHeader_orig;
-typedef MMRESULT (WINAPI *midiOutShortMsg_type)( HMIDIOUT hmo, DWORD dwMsg);
-extern midiOutShortMsg_type midiOutShortMsg_orig;
-typedef MMRESULT (WINAPI *midiOutLongMsg_type)(HMIDIOUT hmo, LPMIDIHDR pmh, UINT cbmh);
-extern midiOutLongMsg_type midiOutLongMsg_orig;
-typedef MMRESULT (WINAPI *midiOutReset_type)( HMIDIOUT hmo);
-extern midiOutReset_type midiOutReset_orig;
-typedef MMRESULT (WINAPI *midiOutCachePatches_type)( HMIDIOUT hmo, UINT uBank, LPWORD pwpa, UINT fuCache);
-extern midiOutCachePatches_type midiOutCachePatches_orig;
-typedef MMRESULT (WINAPI *midiOutCacheDrumPatches_type)( HMIDIOUT hmo, UINT uPatch, LPWORD pwkya, UINT fuCache);
-extern midiOutCacheDrumPatches_type midiOutCacheDrumPatches_orig;
-typedef MMRESULT (WINAPI *midiOutGetID_type)( HMIDIOUT hmo, LPUINT puDeviceID);
-extern midiOutGetID_type midiOutGetID_orig;
-typedef MMRESULT (WINAPI *midiOutMessage_type)( HMIDIOUT hmo, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
-extern midiOutMessage_type midiOutMessage_orig;
-typedef UINT (WINAPI *midiInGetNumDevs_type)(void);
-extern midiInGetNumDevs_type midiInGetNumDevs_orig;
-typedef MMRESULT (WINAPI *midiInGetDevCapsA_type)( UINT_PTR uDeviceID, LPMIDIINCAPSA pmic, UINT cbmic);
-extern midiInGetDevCapsA_type midiInGetDevCapsA_orig;
-typedef MMRESULT (WINAPI *midiInGetDevCapsW_type)( UINT_PTR uDeviceID, LPMIDIINCAPSW pmic, UINT cbmic);
-extern midiInGetDevCapsW_type midiInGetDevCapsW_orig;
-typedef MMRESULT (WINAPI *midiInGetErrorTextA_type)( MMRESULT mmrError, LPSTR pszText, UINT cchText);
-extern midiInGetErrorTextA_type midiInGetErrorTextA_orig;
-typedef MMRESULT (WINAPI *midiInGetErrorTextW_type)( MMRESULT mmrError, LPWSTR pszText, UINT cchText);
-extern midiInGetErrorTextW_type midiInGetErrorTextW_orig;
-typedef MMRESULT (WINAPI *midiInOpen_type)( LPHMIDIIN phmi, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
-extern midiInOpen_type midiInOpen_orig;
-typedef MMRESULT (WINAPI *midiInClose_type)( HMIDIIN hmi);
-extern midiInClose_type midiInClose_orig;
-typedef MMRESULT (WINAPI *midiInPrepareHeader_type)( HMIDIIN hmi, LPMIDIHDR pmh, UINT cbmh);
-extern midiInPrepareHeader_type midiInPrepareHeader_orig;
-typedef MMRESULT (WINAPI *midiInUnprepareHeader_type)( HMIDIIN hmi, LPMIDIHDR pmh, UINT cbmh);
-extern midiInUnprepareHeader_type midiInUnprepareHeader_orig;
-typedef MMRESULT (WINAPI *midiInAddBuffer_type)( HMIDIIN hmi, LPMIDIHDR pmh, UINT cbmh);
-extern midiInAddBuffer_type midiInAddBuffer_orig;
-typedef MMRESULT (WINAPI *midiInStart_type)( HMIDIIN hmi);
-extern midiInStart_type midiInStart_orig;
-typedef MMRESULT (WINAPI *midiInStop_type)( HMIDIIN hmi);
-extern midiInStop_type midiInStop_orig;
-typedef MMRESULT (WINAPI *midiInReset_type)( HMIDIIN hmi);
-extern midiInReset_type midiInReset_orig;
-typedef MMRESULT (WINAPI *midiInGetID_type)( HMIDIIN hmi, LPUINT puDeviceID);
-extern midiInGetID_type midiInGetID_orig;
-typedef MMRESULT (WINAPI *midiInMessage_type)( HMIDIIN hmi, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
-extern midiInMessage_type midiInMessage_orig;
-typedef UINT (WINAPI *auxGetNumDevs_type)(void);
-extern auxGetNumDevs_type auxGetNumDevs_orig;
-typedef MMRESULT (WINAPI *auxGetDevCapsA_type)( UINT_PTR uDeviceID, LPAUXCAPSA pac, UINT cbac);
-extern auxGetDevCapsA_type auxGetDevCapsA_orig;
-typedef MMRESULT (WINAPI *auxGetDevCapsW_type)( UINT_PTR uDeviceID, LPAUXCAPSW pac, UINT cbac);
-extern auxGetDevCapsW_type auxGetDevCapsW_orig;
-typedef MMRESULT (WINAPI *auxSetVolume_type)( UINT uDeviceID, DWORD dwVolume);
-extern auxSetVolume_type auxSetVolume_orig;
-typedef MMRESULT (WINAPI *auxGetVolume_type)( UINT uDeviceID, LPDWORD pdwVolume);
-extern auxGetVolume_type auxGetVolume_orig;
-typedef MMRESULT (WINAPI *auxOutMessage_type)( UINT uDeviceID, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2);
-extern auxOutMessage_type auxOutMessage_orig;
-typedef UINT (WINAPI *mixerGetNumDevs_type)(void);
-extern mixerGetNumDevs_type mixerGetNumDevs_orig;
-typedef MMRESULT (WINAPI *mixerGetDevCapsA_type)( UINT_PTR uMxId, LPMIXERCAPSA pmxcaps, UINT cbmxcaps);
-extern mixerGetDevCapsA_type mixerGetDevCapsA_orig;
-typedef MMRESULT (WINAPI *mixerGetDevCapsW_type)( UINT_PTR uMxId, LPMIXERCAPSW pmxcaps, UINT cbmxcaps);
-extern mixerGetDevCapsW_type mixerGetDevCapsW_orig;
-typedef MMRESULT (WINAPI *mixerOpen_type)( LPHMIXER phmx, UINT uMxId, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen);
-extern mixerOpen_type mixerOpen_orig;
-typedef MMRESULT (WINAPI *mixerClose_type)( HMIXER hmx);
-extern mixerClose_type mixerClose_orig;
-typedef DWORD (WINAPI *mixerMessage_type)( HMIXER hmx, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
-extern mixerMessage_type mixerMessage_orig;
-typedef MMRESULT (WINAPI *mixerGetLineInfoA_type)( HMIXEROBJ hmxobj, LPMIXERLINEA pmxl, DWORD fdwInfo);
-extern mixerGetLineInfoA_type mixerGetLineInfoA_orig;
-typedef MMRESULT (WINAPI *mixerGetLineInfoW_type)( HMIXEROBJ hmxobj, LPMIXERLINEW pmxl, DWORD fdwInfo);
-extern mixerGetLineInfoW_type mixerGetLineInfoW_orig;
-typedef MMRESULT (WINAPI *mixerGetID_type)( HMIXEROBJ hmxobj, UINT FAR *puMxId, DWORD fdwId);
-extern mixerGetID_type mixerGetID_orig;
-typedef MMRESULT (WINAPI *mixerGetLineControlsA_type)( HMIXEROBJ hmxobj, LPMIXERLINECONTROLSA pmxlc, DWORD fdwControls);
-extern mixerGetLineControlsA_type mixerGetLineControlsA_orig;
-typedef MMRESULT (WINAPI *mixerGetLineControlsW_type)( HMIXEROBJ hmxobj, LPMIXERLINECONTROLSW pmxlc, DWORD fdwControls);
-extern mixerGetLineControlsW_type mixerGetLineControlsW_orig;
-typedef MMRESULT (WINAPI *mixerGetControlDetailsA_type)( HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails);
-extern mixerGetControlDetailsA_type mixerGetControlDetailsA_orig;
-typedef MMRESULT (WINAPI *mixerGetControlDetailsW_type)( HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails);
-extern mixerGetControlDetailsW_type mixerGetControlDetailsW_orig;
-typedef MMRESULT (WINAPI *mixerSetControlDetails_type)( HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails);
-extern mixerSetControlDetails_type mixerSetControlDetails_orig;
-typedef DWORD    (WINAPI *mmGetCurrentTask_type)(void);
-extern mmGetCurrentTask_type mmGetCurrentTask_orig;
-typedef void (WINAPI *mmTaskBlock_type)(DWORD);
-extern mmTaskBlock_type mmTaskBlock_orig;
-typedef UINT (WINAPI *mmTaskCreate_type)(LPTASKCALLBACK, HANDLE*, DWORD_PTR);
-extern mmTaskCreate_type mmTaskCreate_orig;
-typedef BOOL (WINAPI *mmTaskSignal_type)(DWORD);
-extern mmTaskSignal_type mmTaskSignal_orig;
-typedef VOID (WINAPI *mmTaskYield_type)(VOID);
-extern mmTaskYield_type mmTaskYield_orig;
-typedef MMRESULT (WINAPI *timeGetSystemTime_type)( LPMMTIME pmmt, UINT cbmmt);
-extern timeGetSystemTime_type timeGetSystemTime_orig;
-typedef DWORD (WINAPI *timeGetTime_type)(void);
-extern timeGetTime_type timeGetTime_orig;
-typedef MMRESULT (WINAPI *timeSetEvent_type)( UINT uDelay, UINT uResolution, LPTIMECALLBACK fptc, DWORD_PTR dwUser, UINT fuEvent);
-extern timeSetEvent_type timeSetEvent_orig;
-typedef MMRESULT (WINAPI *timeKillEvent_type)( UINT uTimerID);
-extern timeKillEvent_type timeKillEvent_orig;
-typedef MMRESULT (WINAPI *timeGetDevCaps_type)( LPTIMECAPS ptc, UINT cbtc);
-extern timeGetDevCaps_type timeGetDevCaps_orig;
-typedef MMRESULT (WINAPI *timeBeginPeriod_type)( UINT uPeriod);
-extern timeBeginPeriod_type timeBeginPeriod_orig;
-typedef MMRESULT (WINAPI *timeEndPeriod_type)( UINT uPeriod);
-extern timeEndPeriod_type timeEndPeriod_orig;
-typedef UINT (WINAPI *joyGetNumDevs_type)(void);
-extern joyGetNumDevs_type joyGetNumDevs_orig;
-typedef MMRESULT (WINAPI *joyConfigChanged_type)(DWORD dwFlags);
-extern joyConfigChanged_type joyConfigChanged_orig;
-typedef MMRESULT (WINAPI *joyGetDevCapsA_type)( UINT_PTR uJoyID, LPJOYCAPSA pjc, UINT cbjc);
-extern joyGetDevCapsA_type joyGetDevCapsA_orig;
-typedef MMRESULT (WINAPI *joyGetDevCapsW_type)( UINT_PTR uJoyID, LPJOYCAPSW pjc, UINT cbjc);
-extern joyGetDevCapsW_type joyGetDevCapsW_orig;
-typedef MMRESULT (WINAPI *joyGetPos_type)( UINT uJoyID, LPJOYINFO pji);
-extern joyGetPos_type joyGetPos_orig;
-typedef MMRESULT (WINAPI *joyGetPosEx_type)( UINT uJoyID, LPJOYINFOEX pji);
-extern joyGetPosEx_type joyGetPosEx_orig;
-typedef MMRESULT (WINAPI *joyGetThreshold_type)( UINT uJoyID, LPUINT puThreshold);
-extern joyGetThreshold_type joyGetThreshold_orig;
-typedef MMRESULT (WINAPI *joyReleaseCapture_type)( UINT uJoyID);
-extern joyReleaseCapture_type joyReleaseCapture_orig;
-typedef MMRESULT (WINAPI *joySetCapture_type)( HWND hwnd, UINT uJoyID, UINT uPeriod, BOOL fChanged);
-extern joySetCapture_type joySetCapture_orig;
-typedef MMRESULT (WINAPI *joySetThreshold_type)( UINT uJoyID, UINT uThreshold);
-extern joySetThreshold_type joySetThreshold_orig;
-typedef BOOL(WINAPI  *mciDriverNotify_type)(HANDLE hwndCallback, MCIDEVICEID uDeviceID, UINT uStatus);
-extern mciDriverNotify_type mciDriverNotify_orig;
-typedef UINT (WINAPI  *mciDriverYield_type)(UINT uDeviceID);
-extern mciDriverYield_type mciDriverYield_orig;
-typedef FOURCC (WINAPI *mmioStringToFOURCCA_type)( LPCSTR sz, UINT uFlags);
-extern mmioStringToFOURCCA_type mmioStringToFOURCCA_orig;
-typedef FOURCC (WINAPI *mmioStringToFOURCCW_type)( LPCWSTR sz, UINT uFlags);
-extern mmioStringToFOURCCW_type mmioStringToFOURCCW_orig;
-typedef LPMMIOPROC (WINAPI *mmioInstallIOProcA_type)( FOURCC fccIOProc, LPMMIOPROC pIOProc, DWORD dwFlags);
-extern mmioInstallIOProcA_type mmioInstallIOProcA_orig;
-typedef LPMMIOPROC (WINAPI *mmioInstallIOProcW_type)( FOURCC fccIOProc, LPMMIOPROC pIOProc, DWORD dwFlags);
-extern mmioInstallIOProcW_type mmioInstallIOProcW_orig;
-typedef HMMIO (WINAPI *mmioOpenA_type)( LPSTR pszFileName, LPMMIOINFO pmmioinfo, DWORD fdwOpen);
-extern mmioOpenA_type mmioOpenA_orig;
-typedef HMMIO (WINAPI *mmioOpenW_type)( LPWSTR pszFileName, LPMMIOINFO pmmioinfo, DWORD fdwOpen);
-extern mmioOpenW_type mmioOpenW_orig;
-typedef MMRESULT (WINAPI *mmioRenameA_type)( LPCSTR pszFileName, LPCSTR pszNewFileName, LPCMMIOINFO pmmioinfo, DWORD fdwRename);
-extern mmioRenameA_type mmioRenameA_orig;
-typedef MMRESULT (WINAPI *mmioRenameW_type)( LPCWSTR pszFileName, LPCWSTR pszNewFileName, LPCMMIOINFO pmmioinfo, DWORD fdwRename);
-extern mmioRenameW_type mmioRenameW_orig;
-typedef MMRESULT (WINAPI *mmioClose_type)( HMMIO hmmio, UINT fuClose);
-extern mmioClose_type mmioClose_orig;
-typedef LONG (WINAPI *mmioRead_type)( HMMIO hmmio, HPSTR pch, LONG cch);
-extern mmioRead_type mmioRead_orig;
-typedef LONG (WINAPI *mmioWrite_type)( HMMIO hmmio, const char _huge* pch, LONG cch);
-extern mmioWrite_type mmioWrite_orig;
-typedef LONG (WINAPI *mmioSeek_type)( HMMIO hmmio, LONG lOffset, int iOrigin);
-extern mmioSeek_type mmioSeek_orig;
-typedef MMRESULT (WINAPI *mmioGetInfo_type)( HMMIO hmmio, LPMMIOINFO pmmioinfo, UINT fuInfo);
-extern mmioGetInfo_type mmioGetInfo_orig;
-typedef MMRESULT (WINAPI *mmioSetInfo_type)( HMMIO hmmio, LPCMMIOINFO pmmioinfo, UINT fuInfo);
-extern mmioSetInfo_type mmioSetInfo_orig;
-typedef MMRESULT (WINAPI *mmioSetBuffer_type)( HMMIO hmmio, LPSTR pchBuffer, LONG cchBuffer, UINT fuBuffer);
-extern mmioSetBuffer_type mmioSetBuffer_orig;
-typedef MMRESULT (WINAPI *mmioFlush_type)( HMMIO hmmio, UINT fuFlush);
-extern mmioFlush_type mmioFlush_orig;
-typedef MMRESULT (WINAPI *mmioAdvance_type)( HMMIO hmmio, LPMMIOINFO pmmioinfo, UINT fuAdvance);
-extern mmioAdvance_type mmioAdvance_orig;
-typedef LRESULT (WINAPI *mmioSendMessage_type)( HMMIO hmmio, UINT uMsg, LPARAM lParam1, LPARAM lParam2);
-extern mmioSendMessage_type mmioSendMessage_orig;
-typedef MMRESULT (WINAPI *mmioDescend_type)( HMMIO hmmio, LPMMCKINFO pmmcki, const MMCKINFO FAR* pmmckiParent, UINT fuDescend);
-extern mmioDescend_type mmioDescend_orig;
-typedef MMRESULT (WINAPI *mmioAscend_type)( HMMIO hmmio, LPMMCKINFO pmmcki, UINT fuAscend);
-extern mmioAscend_type mmioAscend_orig;
-typedef MMRESULT (WINAPI *mmioCreateChunk_type)(HMMIO hmmio, LPMMCKINFO pmmcki, UINT fuCreate);
-extern mmioCreateChunk_type mmioCreateChunk_orig;
-typedef MCIERROR (WINAPI *mciSendCommandA_type)( MCIDEVICEID mciId, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
-extern mciSendCommandA_type mciSendCommandA_orig;
-typedef MCIERROR (WINAPI *mciSendCommandW_type)( MCIDEVICEID mciId, UINT uMsg, DWORD_PTR dwParam1, DWORD_PTR dwParam2);
-extern mciSendCommandW_type mciSendCommandW_orig;
-typedef MCIERROR  (WINAPI *mciSendStringA_type)( LPCSTR lpstrCommand, LPSTR lpstrReturnString, UINT uReturnLength, HWND hwndCallback);
-extern mciSendStringA_type mciSendStringA_orig;
-typedef MCIERROR  (WINAPI *mciSendStringW_type)( LPCWSTR lpstrCommand, LPWSTR lpstrReturnString, UINT uReturnLength, HWND hwndCallback);
-extern mciSendStringW_type mciSendStringW_orig;
-typedef MCIDEVICEID (WINAPI *mciGetDeviceIDA_type)( LPCSTR pszDevice);
-extern mciGetDeviceIDA_type mciGetDeviceIDA_orig;
-typedef MCIDEVICEID (WINAPI *mciGetDeviceIDW_type)( LPCWSTR pszDevice);
-extern mciGetDeviceIDW_type mciGetDeviceIDW_orig;
-typedef MCIDEVICEID (WINAPI *mciGetDeviceIDFromElementIDA_type)( DWORD dwElementID, LPCSTR lpstrType );
-extern mciGetDeviceIDFromElementIDA_type mciGetDeviceIDFromElementIDA_orig;
-typedef MCIDEVICEID (WINAPI *mciGetDeviceIDFromElementIDW_type)( DWORD dwElementID, LPCWSTR lpstrType );
-extern mciGetDeviceIDFromElementIDW_type mciGetDeviceIDFromElementIDW_orig;
-typedef DWORD_PTR (WINAPI  *mciGetDriverData_type)(UINT uDeviceID);
-extern mciGetDriverData_type mciGetDriverData_orig;
-typedef BOOL (WINAPI *mciGetErrorStringA_type)( MCIERROR mcierr, LPSTR pszText, UINT cchText);
-extern mciGetErrorStringA_type mciGetErrorStringA_orig;
-typedef BOOL (WINAPI *mciGetErrorStringW_type)( MCIERROR mcierr, LPWSTR pszText, UINT cchText);
-extern mciGetErrorStringW_type mciGetErrorStringW_orig;
-typedef BOOL (WINAPI  *mciSetDriverData_type)(UINT uDeviceID, DWORD_PTR dwData);
-extern mciSetDriverData_type mciSetDriverData_orig;
-typedef BOOL (WINAPI *mciSetYieldProc_type)( MCIDEVICEID mciId, YIELDPROC fpYieldProc, DWORD dwYieldData);
-extern mciSetYieldProc_type mciSetYieldProc_orig;
-typedef BOOL (WINAPI  *mciFreeCommandResource_type)(UINT uTable);
-extern mciFreeCommandResource_type mciFreeCommandResource_orig;
-typedef HTASK (WINAPI *mciGetCreatorTask_type)( MCIDEVICEID mciId);
-extern mciGetCreatorTask_type mciGetCreatorTask_orig;
-typedef YIELDPROC (WINAPI *mciGetYieldProc_type)( MCIDEVICEID mciId, LPDWORD pdwYieldData);
-extern mciGetYieldProc_type mciGetYieldProc_orig;
-typedef UINT (WINAPI *mciLoadCommandResource_type)(HANDLE hInstance, LPCWSTR lpResName, UINT uType);
-extern mciLoadCommandResource_type mciLoadCommandResource_orig;
-typedef BOOL (WINAPI *mciExecute_type)(LPCSTR pszCommand);
-extern mciExecute_type mciExecute_orig;
diff --git a/indra/media_plugins/winmmshim/winmm.def b/indra/media_plugins/winmmshim/winmm.def
deleted file mode 100755
index c55a2845f8..0000000000
--- a/indra/media_plugins/winmmshim/winmm.def
+++ /dev/null
@@ -1,218 +0,0 @@
-; 
-;   winmm.def
-;
-;   Exports for WINMM DLL
-;
-
-LIBRARY WINMM
-EXPORTS
-CloseDriver
-DefDriverProc
-DriverCallback
-DrvGetModuleHandle
-GetDriverModuleHandle
-;MigrateAllDrivers
-;MigrateSoundEvents
-;NotifyCallbackData
-OpenDriver
-;PlaySound
-PlaySoundA
-PlaySoundW
-SendDriverMessage
-;WOW32DriverCallback
-;WOW32ResolveMultiMediaHandle
-;WOWAppExit
-;WinmmLogoff
-;WinmmLogon
-;aux32Message
-auxGetDevCapsA
-auxGetDevCapsW
-auxGetNumDevs
-auxGetVolume
-auxOutMessage
-auxSetVolume
-;gfxAddGfx
-;gfxBatchChange
-;gfxCreateGfxFactoriesList
-;gfxCreateZoneFactoriesList
-;gfxDestroyDeviceInterfaceList
-;gfxEnumerateGfxs
-;gfxLogoff
-;gfxLogon
-;gfxModifyGfx
-;gfxOpenGfx
-;gfxRemoveGfx
-;joy32Message
-joyConfigChanged
-joyGetDevCapsA
-joyGetDevCapsW
-joyGetNumDevs
-joyGetPos
-joyGetPosEx
-joyGetThreshold
-joyReleaseCapture
-joySetCapture
-joySetThreshold
-;mci32Message
-mciDriverNotify
-mciDriverYield
-mciExecute
-mciFreeCommandResource
-mciGetCreatorTask
-mciGetDeviceIDA
-mciGetDeviceIDFromElementIDA
-mciGetDeviceIDFromElementIDW
-mciGetDeviceIDW
-mciGetDriverData
-mciGetErrorStringA
-mciGetErrorStringW
-mciGetYieldProc
-mciLoadCommandResource
-mciSendCommandA
-mciSendCommandW
-mciSendStringA
-mciSendStringW
-mciSetDriverData
-mciSetYieldProc
-;mid32Message
-midiConnect
-midiDisconnect
-midiInAddBuffer
-midiInClose
-midiInGetDevCapsA
-midiInGetDevCapsW
-midiInGetErrorTextA
-midiInGetErrorTextW
-midiInGetID
-midiInGetNumDevs
-midiInMessage
-midiInOpen
-midiInPrepareHeader
-midiInReset
-midiInStart
-midiInStop
-midiInUnprepareHeader
-midiOutCacheDrumPatches
-midiOutCachePatches
-midiOutClose
-midiOutGetDevCapsA
-midiOutGetDevCapsW
-midiOutGetErrorTextA
-midiOutGetErrorTextW
-midiOutGetID
-midiOutGetNumDevs
-midiOutGetVolume
-midiOutLongMsg
-midiOutMessage
-midiOutOpen
-midiOutPrepareHeader
-midiOutReset
-midiOutSetVolume
-midiOutShortMsg
-midiOutUnprepareHeader
-midiStreamClose
-midiStreamOpen
-midiStreamOut
-midiStreamPause
-midiStreamPosition
-midiStreamProperty
-midiStreamRestart
-midiStreamStop
-mixerClose
-mixerGetControlDetailsA
-mixerGetControlDetailsW
-mixerGetDevCapsA
-mixerGetDevCapsW
-mixerGetID
-mixerGetLineControlsA
-mixerGetLineControlsW
-mixerGetLineInfoA
-mixerGetLineInfoW
-mixerGetNumDevs
-mixerMessage
-mixerOpen
-mixerSetControlDetails
-;mmDrvInstall
-mmGetCurrentTask
-mmTaskBlock
-mmTaskCreate
-mmTaskSignal
-mmTaskYield
-mmioAdvance
-mmioAscend
-mmioClose
-mmioCreateChunk
-mmioDescend
-mmioFlush
-mmioGetInfo
-mmioInstallIOProcA
-mmioInstallIOProcW
-mmioOpenA
-mmioOpenW
-mmioRead
-mmioRenameA
-mmioRenameW
-mmioSeek
-mmioSendMessage
-mmioSetBuffer
-mmioSetInfo
-mmioStringToFOURCCA
-mmioStringToFOURCCW
-mmioWrite
-mmsystemGetVersion
-;mod32Message
-;mxd32Message
-sndPlaySoundA
-sndPlaySoundW
-;tid32Message
-timeBeginPeriod
-timeEndPeriod
-timeGetDevCaps
-timeGetSystemTime
-timeGetTime
-timeKillEvent
-timeSetEvent
-waveInAddBuffer
-waveInClose
-waveInGetDevCapsA
-waveInGetDevCapsW
-waveInGetErrorTextA
-waveInGetErrorTextW
-waveInGetID
-waveInGetNumDevs
-waveInGetPosition
-waveInMessage
-waveInOpen
-waveInPrepareHeader
-waveInReset
-waveInStart
-waveInStop
-waveInUnprepareHeader
-waveOutBreakLoop
-waveOutClose
-waveOutGetDevCapsA
-waveOutGetDevCapsW
-waveOutGetErrorTextA
-waveOutGetErrorTextW
-waveOutGetID
-waveOutGetNumDevs
-waveOutGetPitch
-waveOutGetPlaybackRate
-waveOutGetPosition
-waveOutGetVolume
-waveOutMessage
-waveOutOpen
-waveOutPause
-waveOutPrepareHeader
-waveOutReset
-waveOutRestart
-waveOutSetPitch
-waveOutSetPlaybackRate
-waveOutSetVolume
-waveOutUnprepareHeader
-waveOutWrite
-;wid32Message
-;winmmSetDebugLevel
-;wod32Message
-setPluginVolume
-setPluginMute
\ No newline at end of file
diff --git a/indra/media_plugins/winmmshim/winmm_shim.cpp b/indra/media_plugins/winmmshim/winmm_shim.cpp
deleted file mode 100644
index 78f7a9b0da..0000000000
--- a/indra/media_plugins/winmmshim/winmm_shim.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-/** 
- * @file winmmshim.cpp
- * @brief controls volume level of process by intercepting calls to winmm.dll
- *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010-2014, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-#include "forwarding_api.h"
-#include <xmmintrin.h>
-#include <map>
-#include <math.h>
-
-using std::wstring;
-
-static float sVolumeLevel = 1.f;		// Could be covered by critical section,
-static bool sMute = false;				// not needed with atomicity and alignment.
-static CRITICAL_SECTION sCriticalSection;
-
-BOOL APIENTRY DllMain( HMODULE hModule,
-                       DWORD  ul_reason_for_call,
-                       LPVOID lpReserved
-					 )
-{
-	if (ul_reason_for_call == DLL_PROCESS_ATTACH)
-	{
-		InitializeCriticalSection(&sCriticalSection);
-	}
-	return TRUE;
-}
-
-void ll_winmm_shim_initialize(){
-	static volatile bool initialized = false;
-
-	// do this only once using double-check locking
-	if (!initialized)
-	{
-		EnterCriticalSection(&sCriticalSection);
-		if (!initialized)
-		{	// bind to original winmm.dll
-			TCHAR system_path[MAX_PATH];
-			TCHAR dll_path[MAX_PATH];
-			::GetSystemDirectory(system_path, MAX_PATH);
-
-			// grab winmm.dll from system path, where it should live
-			wsprintf(dll_path, "%s\\winmm.dll", system_path);
-			HMODULE winmm_handle = ::LoadLibrary(dll_path);
-
-			if (winmm_handle != NULL)
-			{	// we have a dll, let's get out pointers!
-				init_function_pointers(winmm_handle);
-				::OutputDebugStringA("WINMM_SHIM.DLL: real winmm.dll initialized successfully\n");
-				initialized = true;		// Last thing after completing setup
-			}
-			else
-			{
-				// failed to initialize real winmm.dll
-				::OutputDebugStringA("WINMM_SHIM.DLL: Failed to initialize real winmm.dll\n");
-			}
-		}
-		LeaveCriticalSection(&sCriticalSection);
-	}
-}
-
-
-extern "C" 
-{
-	// tracks the requested format for a given waveout buffer
-	struct WaveOutFormat
-	{
-		WaveOutFormat(int bits_per_sample)
-		:	mBitsPerSample(bits_per_sample)
-		{}
-		int	mBitsPerSample;
-	};
-	typedef std::map<HWAVEOUT, WaveOutFormat*> wave_out_map_t;
-	static wave_out_map_t sWaveOuts;						// Covered by sCriticalSection
-
-	MMRESULT WINAPI waveOutOpen( LPHWAVEOUT phwo, UINT uDeviceID, LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
-	{
-		ll_winmm_shim_initialize();
-		if (pwfx->wFormatTag != WAVE_FORMAT_PCM
-			|| (pwfx->wBitsPerSample != 8 && pwfx->wBitsPerSample != 16))
-		{ // uncompressed 8 and 16 bit sound are the only types we support
-			return WAVERR_BADFORMAT;
-		}
-
-		MMRESULT result = waveOutOpen_orig(phwo, uDeviceID, pwfx, dwCallback, dwInstance, fdwOpen);
-		if (result == MMSYSERR_NOERROR 
-			&& ((fdwOpen & WAVE_FORMAT_QUERY) == 0)) // not just querying for format support
-		{	// remember the requested bits per sample, and associate with the given handle
-			WaveOutFormat* wave_outp = new WaveOutFormat(pwfx->wBitsPerSample);
-			EnterCriticalSection(&sCriticalSection);
-			sWaveOuts.insert(std::make_pair(*phwo, wave_outp));
-			LeaveCriticalSection(&sCriticalSection);
-		}
-		return result;
-	}
-
-	MMRESULT WINAPI waveOutClose( HWAVEOUT hwo)
-	{
-		ll_winmm_shim_initialize();
-		EnterCriticalSection(&sCriticalSection);
-		wave_out_map_t::iterator found_it = sWaveOuts.find(hwo);
-		if (found_it != sWaveOuts.end())
-		{	// forget what we know about this handle
-			delete found_it->second;
-			sWaveOuts.erase(found_it);
-		}
-		LeaveCriticalSection(&sCriticalSection);
-		return waveOutClose_orig(hwo);
-	}
-
-	MMRESULT WINAPI waveOutWrite( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh)
-	{
-		ll_winmm_shim_initialize();
-		MMRESULT result = MMSYSERR_NOERROR;
-
-		if (sMute)
-		{ // zero out the audio buffer when muted
-			memset(pwh->lpData, 0, pwh->dwBufferLength);
-		}
-		else if (sVolumeLevel != 1.f) 
-		{ // need to apply volume level
-			int bits_per_sample(0);
-			
-			EnterCriticalSection(&sCriticalSection);
-			wave_out_map_t::iterator found_it = sWaveOuts.find(hwo);
-			if (found_it != sWaveOuts.end())
-			{
-				bits_per_sample = found_it->second->mBitsPerSample;
-			}
-			LeaveCriticalSection(&sCriticalSection);
-			if (bits_per_sample)
-			{
-				switch (bits_per_sample)
-				{
-				case 8:
-					{
-						char volume = (char)(sVolumeLevel * 127.f);
-						for (unsigned int i = 0; i < pwh->dwBufferLength; i++)
-						{
-							// unsigned multiply doesn't use most significant bit, so shift by 7 bits
-							// to get resulting value back into 8 bits
-							pwh->lpData[i] = (pwh->lpData[i] * volume) >> 7;
-						}
-						break;
-					}
-				case 16:
-					{
-						short volume_16 = (short)(sVolumeLevel * 32767.f);
-
-						// copy volume level 4 times into 64 bit MMX register
-						__m64 volume_64 = _mm_set_pi16(volume_16, volume_16, volume_16, volume_16);
-						__m64* sample_64;
-						__m64* last_sample_64 =  (__m64*)(pwh->lpData + pwh->dwBufferLength - sizeof(__m64));
-						// for everything that can be addressed in 64 bit multiples...
-						for (sample_64 = (__m64*)pwh->lpData;
-							sample_64 <= last_sample_64;
-							++sample_64)
-						{
-							//...multiply the samples by the volume...
-							__m64 scaled_sample = _mm_mulhi_pi16(*sample_64, volume_64);
-							// ...and shift left 1 bit since an unsigned multiple loses the most significant bit
-							// 0x7FFF * 0x7FFF = 0x3fff0001
-							// 0x3fff0001 << 1 = 0x7ffe0002
-							// notice that the LSB is always 0...should consider dithering
-							*sample_64 =  _mm_slli_pi16(scaled_sample, 1); 
-						}
-
-						// the captain has turned off the MMX sign, you are now free to use floating point registers
-						_mm_empty();
-
-						// finish remaining samples that didn't fit into 64 bit register
-						for (short* sample_16 = (short*)sample_64;
-							sample_16 < (short*)(pwh->lpData + pwh->dwBufferLength);
-							++sample_16)
-						{	
-							*sample_16 = (*sample_16 * volume_16) >> 15;
-						}
-
-						break;
-					}
-				default:
-					// don't do anything
-					break;
-				}
-			}
-		}
-		return waveOutWrite_orig( hwo, pwh, cbwh);
-	}
-
-	void WINAPI setPluginVolume(float volume)
-	{
-		sVolumeLevel = volume;
-	}
-
-	void WINAPI setPluginMute(bool mute)
-	{
-		sMute = mute;
-	}
-}
-- 
cgit v1.2.3