Merge branch 'master' of git://github.com/LightDrake/SingularityViewer
This commit is contained in:
@@ -81,6 +81,7 @@ set(cmake_SOURCE_FILES
|
||||
Linking.cmake
|
||||
MediaPluginBase.cmake
|
||||
NDOF.cmake
|
||||
NVAPI.cmake
|
||||
OPENAL.cmake
|
||||
OpenGL.cmake
|
||||
OpenJPEG.cmake
|
||||
|
||||
21
indra/cmake/NVAPI.cmake
Normal file
21
indra/cmake/NVAPI.cmake
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
include(Variables)
|
||||
|
||||
set(NVAPI ON CACHE BOOL "Use NVAPI.")
|
||||
|
||||
if (NVAPI)
|
||||
if (WINDOWS)
|
||||
use_prebuilt_binary(nvapi)
|
||||
if (WORD_SIZE EQUAL 32)
|
||||
set(NVAPI_LIBRARY nvapi)
|
||||
elseif (WORD_SIZE EQUAL 64)
|
||||
set(NVAPI_LIBRARY nvapi64)
|
||||
endif (WORD_SIZE EQUAL 32)
|
||||
else (WINDOWS)
|
||||
set(NVAPI_LIBRARY "")
|
||||
endif (WINDOWS)
|
||||
else (NVAPI)
|
||||
set(NVAPI_LIBRARY "")
|
||||
endif (NVAPI)
|
||||
|
||||
@@ -38,6 +38,7 @@ include(LLXML)
|
||||
#include(LScript)
|
||||
include(Linking)
|
||||
include(NDOF)
|
||||
include(NVAPI)
|
||||
include(StateMachine)
|
||||
include(TemplateCheck)
|
||||
include(UI)
|
||||
@@ -1598,6 +1599,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
|
||||
${LLMATH_LIBRARIES}
|
||||
${LLCOMMON_LIBRARIES}
|
||||
${NDOF_LIBRARY}
|
||||
${NVAPI_LIBRARY}
|
||||
${viewer_LIBRARIES}
|
||||
${Boost_CONTEXT_LIBRARY}
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
|
||||
@@ -13785,6 +13785,17 @@ This should be as low as possible, but too low may break functionality</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>RevokePermsOnStopAnimation</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Clear animation permssions when choosing "Stop Animating Me"</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>RotateRight</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
#include "llworld.h"
|
||||
#include "llworldmap.h"
|
||||
#include "llworldmapmessage.h"
|
||||
#include "../lscript/lscript_byteformat.h"
|
||||
|
||||
//Misc non-standard includes
|
||||
#include "llurldispatcher.h"
|
||||
@@ -3061,7 +3062,7 @@ LLQuaternion LLAgent::getHeadRotation()
|
||||
return rot;
|
||||
}
|
||||
|
||||
void LLAgent::sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request)
|
||||
void LLAgent::sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request)
|
||||
{
|
||||
if (gAgentID.isNull())
|
||||
{
|
||||
@@ -3076,7 +3077,7 @@ void LLAgent::sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimReque
|
||||
msg->addUUIDFast(_PREHASH_AgentID, getID());
|
||||
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
|
||||
|
||||
for (S32 i = 0; i < anim_ids.count(); i++)
|
||||
for (U32 i = 0; i < anim_ids.size(); i++)
|
||||
{
|
||||
if (anim_ids[i].isNull())
|
||||
{
|
||||
@@ -3118,6 +3119,55 @@ void LLAgent::sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request)
|
||||
sendReliableMessage();
|
||||
}
|
||||
|
||||
// Send a message to the region to stop the NULL animation state
|
||||
// This will reset animation state overrides for the agent.
|
||||
void LLAgent::sendAnimationStateReset()
|
||||
{
|
||||
if (gAgentID.isNull() || !mRegionp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessageFast(_PREHASH_AgentAnimation);
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
msg->addUUIDFast(_PREHASH_AgentID, getID());
|
||||
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
|
||||
|
||||
msg->nextBlockFast(_PREHASH_AnimationList);
|
||||
msg->addUUIDFast(_PREHASH_AnimID, LLUUID::null );
|
||||
msg->addBOOLFast(_PREHASH_StartAnim, FALSE);
|
||||
|
||||
msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
|
||||
msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
|
||||
sendReliableMessage();
|
||||
}
|
||||
|
||||
|
||||
// Send a message to the region to revoke sepecified permissions on ALL scripts in the region
|
||||
// If the target is an object in the region, permissions in scripts on that object are cleared.
|
||||
// If it is the region ID, all scripts clear the permissions for this agent
|
||||
void LLAgent::sendRevokePermissions(const LLUUID & target, U32 permissions)
|
||||
{
|
||||
// Currently only the bits for SCRIPT_PERMISSION_TRIGGER_ANIMATION and SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS
|
||||
// are supported by the server. Sending any other bits will cause the message to be dropped without changing permissions
|
||||
|
||||
if (gAgentID.notNull() && gMessageSystem)
|
||||
{
|
||||
LLMessageSystem* msg = gMessageSystem;
|
||||
msg->newMessageFast(_PREHASH_RevokePermissions);
|
||||
msg->nextBlockFast(_PREHASH_AgentData);
|
||||
msg->addUUIDFast(_PREHASH_AgentID, getID()); // Must be our ID
|
||||
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
|
||||
|
||||
msg->nextBlockFast(_PREHASH_Data);
|
||||
msg->addUUIDFast(_PREHASH_ObjectID, target); // Must be in the region
|
||||
msg->addU32Fast(_PREHASH_ObjectPermissions, permissions);
|
||||
|
||||
sendReliableMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// [RLVa:KB] - Checked: 2011-05-11 (RLVa-1.3.0i) | Added: RLVa-1.3.0i
|
||||
void LLAgent::setAlwaysRun()
|
||||
{
|
||||
@@ -4338,6 +4388,8 @@ void LLAgent::stopCurrentAnimations()
|
||||
// avatar, propagating this change back to the server.
|
||||
if (isAgentAvatarValid())
|
||||
{
|
||||
std::vector<LLUUID> anim_ids;
|
||||
|
||||
for ( LLVOAvatar::AnimIterator anim_it =
|
||||
gAgentAvatarp->mPlayingAnimations.begin();
|
||||
anim_it != gAgentAvatarp->mPlayingAnimations.end();
|
||||
@@ -4355,7 +4407,24 @@ void LLAgent::stopCurrentAnimations()
|
||||
// stop this animation locally
|
||||
gAgentAvatarp->stopMotion(anim_it->first, TRUE);
|
||||
// ...and tell the server to tell everyone.
|
||||
sendAnimationRequest(anim_it->first, ANIM_REQUEST_STOP);
|
||||
anim_ids.push_back(anim_it->first);
|
||||
}
|
||||
}
|
||||
|
||||
sendAnimationRequests(anim_ids, ANIM_REQUEST_STOP);
|
||||
|
||||
// Tell the region to clear any animation state overrides
|
||||
sendAnimationStateReset();
|
||||
|
||||
// Revoke all animation permissions
|
||||
if (mRegionp &&
|
||||
gSavedSettings.getBOOL("RevokePermsOnStopAnimation"))
|
||||
{
|
||||
U32 permissions = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRIGGER_ANIMATION] | LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS];
|
||||
sendRevokePermissions(mRegionp->getRegionID(), permissions);
|
||||
if (gAgentAvatarp->isSitting())
|
||||
{ // Also stand up, since auto-granted sit animation permission has been revoked
|
||||
gAgent.standUp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -464,8 +464,11 @@ public:
|
||||
void stopCurrentAnimations();
|
||||
void requestStopMotion(LLMotion* motion);
|
||||
void onAnimStop(const LLUUID& id);
|
||||
void sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request);
|
||||
void sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request);
|
||||
void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request);
|
||||
void sendAnimationStateReset();
|
||||
void sendRevokePermissions(const LLUUID & target, U32 permissions);
|
||||
|
||||
void endAnimationUpdateUI();
|
||||
void unpauseAnimation() { mPauseRequest = NULL; }
|
||||
BOOL getCustomAnim() const { return mCustomAnim; }
|
||||
|
||||
@@ -52,6 +52,11 @@
|
||||
#include "llviewercontrol.h"
|
||||
#include "lldxhardware.h"
|
||||
|
||||
#include "nvapi/nvapi.h"
|
||||
#include "nvapi/NvApiDriverSettings.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "llweb.h"
|
||||
#include "llsecondlifeurls.h"
|
||||
|
||||
@@ -79,6 +84,19 @@ extern "C" {
|
||||
|
||||
const std::string LLAppViewerWin32::sWindowClass = "Second Life";
|
||||
|
||||
/*
|
||||
This function is used to print to the command line a text message
|
||||
describing the nvapi error and quits
|
||||
*/
|
||||
void nvapi_error(NvAPI_Status status)
|
||||
{
|
||||
NvAPI_ShortString szDesc = {0};
|
||||
NvAPI_GetErrorMessage(status, szDesc);
|
||||
llwarns << szDesc << llendl;
|
||||
|
||||
//should always trigger when asserts are enabled
|
||||
//llassert(status == NVAPI_OK);
|
||||
}
|
||||
|
||||
// Create app mutex creates a unique global windows object.
|
||||
// If the object can be created it returns true, otherwise
|
||||
@@ -101,6 +119,79 @@ bool create_app_mutex()
|
||||
return result;
|
||||
}
|
||||
|
||||
void ll_nvapi_init(NvDRSSessionHandle hSession)
|
||||
{
|
||||
// (2) load all the system settings into the session
|
||||
NvAPI_Status status = NvAPI_DRS_LoadSettings(hSession);
|
||||
if (status != NVAPI_OK)
|
||||
{
|
||||
nvapi_error(status);
|
||||
return;
|
||||
}
|
||||
|
||||
NvAPI_UnicodeString profile_name;
|
||||
//std::string app_name = LLTrans::getString("APP_NAME");
|
||||
std::string app_name("Second Life"); // <alchemy/>
|
||||
llutf16string w_app_name = utf8str_to_utf16str(app_name);
|
||||
wsprintf(profile_name, L"%s", w_app_name.c_str());
|
||||
status = NvAPI_DRS_SetCurrentGlobalProfile(hSession, profile_name);
|
||||
if (status != NVAPI_OK)
|
||||
{
|
||||
nvapi_error(status);
|
||||
return;
|
||||
}
|
||||
|
||||
// (3) Obtain the current profile.
|
||||
NvDRSProfileHandle hProfile = 0;
|
||||
status = NvAPI_DRS_GetCurrentGlobalProfile(hSession, &hProfile);
|
||||
if (status != NVAPI_OK)
|
||||
{
|
||||
nvapi_error(status);
|
||||
return;
|
||||
}
|
||||
|
||||
// load settings for querying
|
||||
status = NvAPI_DRS_LoadSettings(hSession);
|
||||
if (status != NVAPI_OK)
|
||||
{
|
||||
nvapi_error(status);
|
||||
return;
|
||||
}
|
||||
|
||||
//get the preferred power management mode for Second Life
|
||||
NVDRS_SETTING drsSetting = {0};
|
||||
drsSetting.version = NVDRS_SETTING_VER;
|
||||
status = NvAPI_DRS_GetSetting(hSession, hProfile, PREFERRED_PSTATE_ID, &drsSetting);
|
||||
if (status == NVAPI_SETTING_NOT_FOUND)
|
||||
{ //only override if the user hasn't specifically set this setting
|
||||
// (4) Specify that we want the VSYNC disabled setting
|
||||
// first we fill the NVDRS_SETTING struct, then we call the function
|
||||
drsSetting.version = NVDRS_SETTING_VER;
|
||||
drsSetting.settingId = PREFERRED_PSTATE_ID;
|
||||
drsSetting.settingType = NVDRS_DWORD_TYPE;
|
||||
drsSetting.u32CurrentValue = PREFERRED_PSTATE_PREFER_MAX;
|
||||
status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting);
|
||||
if (status != NVAPI_OK)
|
||||
{
|
||||
nvapi_error(status);
|
||||
return;
|
||||
}
|
||||
|
||||
// (5) Now we apply (or save) our changes to the system
|
||||
status = NvAPI_DRS_SaveSettings(hSession);
|
||||
if (status != NVAPI_OK)
|
||||
{
|
||||
nvapi_error(status);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (status != NVAPI_OK)
|
||||
{
|
||||
nvapi_error(status);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//#define DEBUGGING_SEH_FILTER 1
|
||||
#if DEBUGGING_SEH_FILTER
|
||||
# define WINMAIN DebuggingWinMain
|
||||
@@ -157,6 +248,27 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
|
||||
return -1;
|
||||
}
|
||||
|
||||
NvAPI_Status status;
|
||||
|
||||
// Initialize NVAPI
|
||||
status = NvAPI_Initialize();
|
||||
NvDRSSessionHandle hSession = 0;
|
||||
|
||||
if (status == NVAPI_OK)
|
||||
{
|
||||
// Create the session handle to access driver settings
|
||||
status = NvAPI_DRS_CreateSession(&hSession);
|
||||
if (status != NVAPI_OK)
|
||||
{
|
||||
nvapi_error(status);
|
||||
}
|
||||
else
|
||||
{
|
||||
//override driver setting as needed
|
||||
ll_nvapi_init(hSession);
|
||||
}
|
||||
}
|
||||
|
||||
// Have to wait until after logging is initialized to display LFH info
|
||||
if (num_heaps > 0)
|
||||
{
|
||||
@@ -224,6 +336,15 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
|
||||
LLAppViewer::sUpdaterInfo = NULL ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// (NVAPI) (6) We clean up. This is analogous to doing a free()
|
||||
if (hSession)
|
||||
{
|
||||
NvAPI_DRS_DestroySession(hSession);
|
||||
hSession = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
#include "aifile.h"
|
||||
|
||||
#include "llavatarname.h"
|
||||
#include "../lscript/lscript_byteformat.h"
|
||||
|
||||
#include "hippogridmanager.h"
|
||||
|
||||
@@ -6606,14 +6607,8 @@ void LLVOAvatar::getOffObject()
|
||||
|
||||
if (sit_object && !sit_object->permYouOwner() && gSavedSettings.getBOOL("RevokePermsOnStandUp"))
|
||||
{
|
||||
gMessageSystem->newMessageFast(_PREHASH_RevokePermissions);
|
||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||
gMessageSystem->nextBlockFast(_PREHASH_Data);
|
||||
gMessageSystem->addUUIDFast(_PREHASH_ObjectID, sit_object->getID());
|
||||
gMessageSystem->addU32Fast(_PREHASH_ObjectPermissions, 0xFFFFFFFF);
|
||||
gAgent.sendReliableMessage();
|
||||
U32 permissions = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRIGGER_ANIMATION] | LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS];
|
||||
gAgent.sendRevokePermissions(sit_object->getID(), permissions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
31
install.xml
31
install.xml
@@ -1061,6 +1061,32 @@
|
||||
</map>
|
||||
</map>
|
||||
</map>
|
||||
<key>nvapi</key>
|
||||
<map>
|
||||
<key>copyright</key>
|
||||
<string>Copyright (C) NVIDIA</string>
|
||||
<key>description</key>
|
||||
<string>NVAPI is the library suite to access nvidia profiles and performance options on windows</string>
|
||||
<key>license</key>
|
||||
<string>NVAPI</string>
|
||||
<key>packages</key>
|
||||
<map>
|
||||
<key>windows</key>
|
||||
<map>
|
||||
<key>md5sum</key>
|
||||
<string>99d1b70c1305257d521edfbd34587187</string>
|
||||
<key>url</key>
|
||||
<uri>https://bitbucket.org/SingularityViewer/libraries/downloads/nvapi-304-windows-20121116-singu.tar.bz2</uri>
|
||||
</map>
|
||||
<key>windows64</key>
|
||||
<map>
|
||||
<key>md5sum</key>
|
||||
<string>5578017f13783fb7279dd39537d1e0fd</string>
|
||||
<key>url</key>
|
||||
<uri>https://bitbucket.org/SingularityViewer/libraries/downloads/nvapi-304-windows64-20131116-singu.tar.bz2</uri>
|
||||
</map>
|
||||
</map>
|
||||
</map>
|
||||
<key>ndofdev</key>
|
||||
<map>
|
||||
<key>copyright</key>
|
||||
@@ -1873,6 +1899,11 @@ Cass Everitt - cass@r3.nu
|
||||
<key>text</key>
|
||||
<string>http://www.jclark.com/xml/copying.txt</string>
|
||||
</map>
|
||||
<key>NVAPI</key>
|
||||
<map>
|
||||
<key>url</key>
|
||||
<string>Licenes dir</string>
|
||||
</map>
|
||||
<key>ogg-vorbis</key>
|
||||
<map>
|
||||
<key>url</key>
|
||||
|
||||
@@ -835,10 +835,10 @@ def _default_installable_cache():
|
||||
"""In general, the installable files do not change much, so find a
|
||||
host/user specific location to cache files."""
|
||||
user = _getuser()
|
||||
cache_dir = "/var/tmp/%s/install.cache" % user
|
||||
cache_dir = "/var/tmp/%s/sg.install.cache" % user
|
||||
if _get_platform() == 'windows':
|
||||
cache_dir = os.path.join(tempfile.gettempdir(), \
|
||||
'install.cache.%s' % user)
|
||||
'sg.install.cache.%s' % user)
|
||||
return cache_dir
|
||||
|
||||
def parse_args():
|
||||
|
||||
@@ -173,10 +173,10 @@ def _default_installable_cache():
|
||||
"""In general, the installable files do not change much, so find a
|
||||
host/user specific location to cache files."""
|
||||
user = _getuser()
|
||||
cache_dir = "/var/tmp/%s/install.cache" % user
|
||||
cache_dir = "/var/tmp/%s/sg.install.cache" % user
|
||||
if _get_platform() == 'windows':
|
||||
cache_dir = os.path.join(tempfile.gettempdir(), \
|
||||
'install.cache.%s' % user)
|
||||
'sg.install.cache.%s' % user)
|
||||
return cache_dir
|
||||
|
||||
# For status messages (e.g. "Loading..."). May come in handy if
|
||||
|
||||
Reference in New Issue
Block a user