Merge branch 'V2MultiWear' of git://github.com/siana/SingularityViewer into V2MultiWear

This commit is contained in:
Lirusaito
2012-04-21 12:03:42 -04:00
5 changed files with 15 additions and 72 deletions

View File

@@ -363,8 +363,12 @@ S32 LLImageJ2C::calcHeaderSizeJ2C()
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;
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--;
}
S32 bytes = (S32)((F32)(w*h*comp)*rate);
return bytes;
}
//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;
bytes = llmax(bytes, calcHeaderSizeJ2C());
return bytes;
}

View File

@@ -124,9 +124,14 @@ BOOL PreventSetUnhandledExceptionFilter()
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;
//SIZE_T bytesWritten;
//BOOL bRet = WriteProcessMemory( GetCurrentProcess(), pOrgEntry, newJump, sizeof( pNewFunc ) + 1, &bytesWritten );
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
return FALSE;
#endif

View File

@@ -278,29 +278,6 @@
</array>
</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>
<map>
<key>Comment</key>

View File

@@ -114,7 +114,7 @@ BOOL LLPrefsVoice::postBuild()
childSetCommitCallback("enable_voice_check", onCommitEnableVoiceChat, this);
childSetAction("set_voice_hotkey_button", onClickSetKey, 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");
childSetVisible("voice_unavailable", voice_disabled);

View File

@@ -690,31 +690,6 @@ LPTOP_LEVEL_EXCEPTION_FILTER WINAPI MyDummySetUnhandledExceptionFilter(
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
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;
prev_filter = SetUnhandledExceptionFilter(filter_func);
// *REMOVE:Mani
//PreventSetUnhandledExceptionFilter();
if(prev_filter != gFilterFunc)
{
LL_WARNS("AppInit")