Merge branch 'V2MultiWear' of git://github.com/siana/SingularityViewer into V2MultiWear
This commit is contained in:
@@ -363,8 +363,12 @@ S32 LLImageJ2C::calcHeaderSizeJ2C()
|
|||||||
return FIRST_PACKET_SIZE; // Hack. just needs to be >= actual header size...
|
return FIRST_PACKET_SIZE; // Hack. just needs to be >= actual header size...
|
||||||
}
|
}
|
||||||
|
|
||||||
static S32 cald_data_size_help(S32 w, S32 h, S32 comp, S32 discard_level, F32 rate)
|
//static
|
||||||
|
S32 LLImageJ2C::calcDataSizeJ2C(S32 w, S32 h, S32 comp, S32 discard_level, F32 rate)
|
||||||
{
|
{
|
||||||
|
// Note: this only provides an *estimate* of the size in bytes of an image level
|
||||||
|
// *TODO: find a way to read the true size (when available) and convey the fact
|
||||||
|
// that the result is an estimate in the other cases
|
||||||
if (rate <= 0.f) rate = .125f;
|
if (rate <= 0.f) rate = .125f;
|
||||||
while (discard_level > 0)
|
while (discard_level > 0)
|
||||||
{
|
{
|
||||||
@@ -375,22 +379,7 @@ static S32 cald_data_size_help(S32 w, S32 h, S32 comp, S32 discard_level, F32 ra
|
|||||||
discard_level--;
|
discard_level--;
|
||||||
}
|
}
|
||||||
S32 bytes = (S32)((F32)(w*h*comp)*rate);
|
S32 bytes = (S32)((F32)(w*h*comp)*rate);
|
||||||
return bytes;
|
bytes = llmax(bytes, calcHeaderSizeJ2C());
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//static
|
|
||||||
S32 LLImageJ2C::calcDataSizeJ2C(S32 w, S32 h, S32 comp, S32 discard_level, F32 rate)
|
|
||||||
{
|
|
||||||
static const LLCachedControl<F32> exponent("SianaJ2CSizeExponent", 1.0f);
|
|
||||||
static const LLCachedControl<S32> offset("SianaJ2CSizeOffset", 0);
|
|
||||||
S32 size = cald_data_size_help(w, h, comp, discard_level, rate);
|
|
||||||
S32 size_d0 = cald_data_size_help(w, h, comp, 0, rate);
|
|
||||||
|
|
||||||
llassert_always(size_d0);
|
|
||||||
S32 bytes = size_d0*pow((double)size/size_d0, (double)exponent) + offset;
|
|
||||||
bytes = llmax (0, bytes - 600);
|
|
||||||
bytes = ((bytes + (1000 - 1))/1000)*1000 + 600;
|
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,9 +124,14 @@ BOOL PreventSetUnhandledExceptionFilter()
|
|||||||
|
|
||||||
newJump[ 0 ] = 0xE9; // JMP absolute
|
newJump[ 0 ] = 0xE9; // JMP absolute
|
||||||
memcpy( &newJump[ 1 ], &dwRelativeAddr, sizeof( pNewFunc ) );
|
memcpy( &newJump[ 1 ], &dwRelativeAddr, sizeof( pNewFunc ) );
|
||||||
SIZE_T bytesWritten;
|
//SIZE_T bytesWritten;
|
||||||
BOOL bRet = WriteProcessMemory( GetCurrentProcess(), pOrgEntry, newJump, sizeof( pNewFunc ) + 1, &bytesWritten );
|
//BOOL bRet = WriteProcessMemory( GetCurrentProcess(), pOrgEntry, newJump, sizeof( pNewFunc ) + 1, &bytesWritten );
|
||||||
return bRet;
|
DWORD oldProtect;
|
||||||
|
BOOL bRet = VirtualProtect(pOrgEntry, sizeof(pNewFunc) + 1, PAGE_READWRITE, &oldProtect);
|
||||||
|
if (!bRet) return FALSE;
|
||||||
|
memcpy(pOrgEntry, newJump, sizeof(pNewFunc) + 1);
|
||||||
|
VirtualProtect(pOrgEntry, sizeof(pNewFunc) + 1, oldProtect, &oldProtect);
|
||||||
|
return TRUE;
|
||||||
#else
|
#else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -278,29 +278,6 @@
|
|||||||
</array>
|
</array>
|
||||||
</map>
|
</map>
|
||||||
|
|
||||||
<key>SianaJ2CSizeExponent</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Exponent of size estimator. Should be between 0.0 and 1.0</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>F32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<real>1.0</real>
|
|
||||||
</map>
|
|
||||||
<key>SianaJ2CSizeOffset</key>
|
|
||||||
<map>
|
|
||||||
<key>Comment</key>
|
|
||||||
<string>Number of bytes to add to size estimator.</string>
|
|
||||||
<key>Persist</key>
|
|
||||||
<integer>1</integer>
|
|
||||||
<key>Type</key>
|
|
||||||
<string>S32</string>
|
|
||||||
<key>Value</key>
|
|
||||||
<integer>0</integer>
|
|
||||||
</map>
|
|
||||||
|
|
||||||
<key>SianaLegacyJ2CSize</key>
|
<key>SianaLegacyJ2CSize</key>
|
||||||
<map>
|
<map>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ BOOL LLPrefsVoice::postBuild()
|
|||||||
childSetCommitCallback("enable_voice_check", onCommitEnableVoiceChat, this);
|
childSetCommitCallback("enable_voice_check", onCommitEnableVoiceChat, this);
|
||||||
childSetAction("set_voice_hotkey_button", onClickSetKey, this);
|
childSetAction("set_voice_hotkey_button", onClickSetKey, this);
|
||||||
childSetAction("set_voice_middlemouse_button", onClickSetMiddleMouse, this);
|
childSetAction("set_voice_middlemouse_button", onClickSetMiddleMouse, this);
|
||||||
childSetAction("device_settings_btn", onClickVoiceDeviceSettings, NULL);
|
childSetAction("device_settings_btn", onClickVoiceDeviceSettings, this);
|
||||||
|
|
||||||
BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice");
|
BOOL voice_disabled = gSavedSettings.getBOOL("CmdLineDisableVoice");
|
||||||
childSetVisible("voice_unavailable", voice_disabled);
|
childSetVisible("voice_unavailable", voice_disabled);
|
||||||
|
|||||||
@@ -690,31 +690,6 @@ LPTOP_LEVEL_EXCEPTION_FILTER WINAPI MyDummySetUnhandledExceptionFilter(
|
|||||||
return gFilterFunc;
|
return gFilterFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL PreventSetUnhandledExceptionFilter()
|
|
||||||
{
|
|
||||||
HMODULE hKernel32 = LoadLibrary(_T("kernel32.dll"));
|
|
||||||
if (hKernel32 == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
void *pOrgEntry = GetProcAddress(hKernel32, "SetUnhandledExceptionFilter");
|
|
||||||
if(pOrgEntry == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
unsigned char newJump[ 100 ];
|
|
||||||
DWORD dwOrgEntryAddr = (DWORD)pOrgEntry;
|
|
||||||
dwOrgEntryAddr += 5; // add 5 for 5 op-codes for jmp far
|
|
||||||
void *pNewFunc = &MyDummySetUnhandledExceptionFilter;
|
|
||||||
DWORD dwNewEntryAddr = (DWORD) pNewFunc;
|
|
||||||
DWORD dwRelativeAddr = dwNewEntryAddr - dwOrgEntryAddr;
|
|
||||||
|
|
||||||
newJump[ 0 ] = 0xE9; // JMP absolute
|
|
||||||
memcpy(&newJump[ 1 ], &dwRelativeAddr, sizeof(pNewFunc));
|
|
||||||
SIZE_T bytesWritten;
|
|
||||||
BOOL bRet = WriteProcessMemory(GetCurrentProcess(),
|
|
||||||
pOrgEntry, newJump, sizeof(pNewFunc) + 1, &bytesWritten);
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void LLWinDebug::initExceptionHandler(LPTOP_LEVEL_EXCEPTION_FILTER filter_func)
|
void LLWinDebug::initExceptionHandler(LPTOP_LEVEL_EXCEPTION_FILTER filter_func)
|
||||||
{
|
{
|
||||||
@@ -765,9 +740,6 @@ void LLWinDebug::initExceptionHandler(LPTOP_LEVEL_EXCEPTION_FILTER filter_func)
|
|||||||
LPTOP_LEVEL_EXCEPTION_FILTER prev_filter;
|
LPTOP_LEVEL_EXCEPTION_FILTER prev_filter;
|
||||||
prev_filter = SetUnhandledExceptionFilter(filter_func);
|
prev_filter = SetUnhandledExceptionFilter(filter_func);
|
||||||
|
|
||||||
// *REMOVE:Mani
|
|
||||||
//PreventSetUnhandledExceptionFilter();
|
|
||||||
|
|
||||||
if(prev_filter != gFilterFunc)
|
if(prev_filter != gFilterFunc)
|
||||||
{
|
{
|
||||||
LL_WARNS("AppInit")
|
LL_WARNS("AppInit")
|
||||||
|
|||||||
Reference in New Issue
Block a user