diff AudioPlayer.cpp @ 2481:4f4eb812af28

KEY_ALL_ACCESS
author Ritor1
date Fri, 22 Aug 2014 17:41:25 +0600
parents 908baf8e7d23
children 5abd8fc8f1c6
line wrap: on
line diff
--- a/AudioPlayer.cpp	Fri Aug 22 11:07:07 2014 +0600
+++ b/AudioPlayer.cpp	Fri Aug 22 17:41:25 2014 +0600
@@ -2125,7 +2125,7 @@
 {
   DWORD NumberOfBytesRead; // [sp+Ch] [bp-4h]@3
 
-  hAudioSnd = CreateFileA("Sounds\\Audio.snd", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
+  hAudioSnd = CreateFileA("Sounds\\Audio.snd", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, 0);
   if (hAudioSnd == INVALID_HANDLE_VALUE)
   {
     Log::Warning(L"Can't open file: %s", L"Sounds\\Audio.snd");
@@ -2178,7 +2178,7 @@
     v14 = 0;
     bEAXSupported = 0;
     b3DSoundInitialized = 0;
-    ReadWindowsRegistryString("3DSoundProvider", p3DSoundProvider, 128u, "NONE");
+    ReadWindowsRegistryString("3DSoundProvider", p3DSoundProvider, 128, "NONE");
     CheckA3DSupport(true);
     HPROVIDER prov;
     while ( AIL_enumerate_3D_providers(&v14, &prov, &Str1) )
@@ -2225,8 +2225,13 @@
   }
   pAudioPlayer->sRedbookVolume = AIL_redbook_volume(hAILRedbook);
   pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
+  //unsigned __int64 t = (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f);
   if ( bPlayerReady && hAILRedbook )
-    AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f) >> 32);
+    //AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f));
+	AIL_redbook_set_volume(hAILRedbook, (unsigned __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f) >> 32);
+  //int v = AIL_redbook_volume(pAudioPlayer->hAILRedbook);
+  //if (v)
+    //__debugbreak();
   LoadAudioSnd();
 }
 
@@ -2234,10 +2239,9 @@
 _DIG_DRIVER *Audio_GetFirstHardwareDigitalDriver(void)
 {
   int v0; // ecx@1
-  unsigned int v1; // ebp@2
   size_t v2; // eax@4
   signed int v3; // kr14_4@9
-  char *v5; // [sp+10h] [bp-Ch]@2
+  int v5; // [sp+10h] [bp-Ch]@2
   unsigned int pNum_devices; // [sp+14h] [bp-8h]@1
   _DIG_DRIVER *hDrv; // [sp+18h] [bp-4h]@3
   
@@ -2254,8 +2258,7 @@
 
   if ( sample_Rate < 11025 )
     return 0;
-  v1 = 0;
-  v5 = (char *)pAudioPlayer->array_000BF0;
+  v5 = 0;
   while ( 1 )
   {
     while ( 1 )
@@ -2268,16 +2271,15 @@
       pcmWaveFormat.wf.nAvgBytesPerSec = pcmWaveFormat.wf.nSamplesPerSec * pcmWaveFormat.wf.nBlockAlign;
       if ( !AIL_waveOutOpen(&hDrv, 0, -1, &pcmWaveFormat.wf) )
       {
-        strcpy(pAudioPlayer->pDeviceNames[v1 / 8], "Device: ");
-        v2 = strlen(pAudioPlayer->pDeviceNames[v1 / 8]);
-        AIL_digital_configuration(hDrv, (int *)v5, (int *)(v5 + 64), (char *)pAudioPlayer->pDeviceNames + v2 + v1 * 16);
+        strcpy(pAudioPlayer->pDeviceNames[v5], "Device: ");
+        v2 = strlen(pAudioPlayer->pDeviceNames[v5]);
+        AIL_digital_configuration(hDrv, (int *)pAudioPlayer->array_000BF0 + v5, (int *)pAudioPlayer->array_000C30 + v5, (char *)pAudioPlayer->pDeviceNames + v2 + v5 * 32);
         ++pNum_devices;
-        v1 += 8;
-        v5 += 4;
+        v5++;
         pAudioPlayer->uNumDevices = pNum_devices;
         if ( AIL_get_preference(15) )
           return hDrv;
-        if ( !strstr(pAudioPlayer->pDeviceNames[v1 / 8 - 1], "Emulated") )
+        if ( !strstr(pAudioPlayer->pDeviceNames[v5 - 1], "Emulated") )
           return hDrv;
         AIL_waveOutClose(hDrv);
         AIL_set_preference(15, 1);
@@ -2316,7 +2318,7 @@
   HKEY hKey; // [sp+10h] [bp-4h]@1
   hKey = 0;
   cbData = 4;
-  if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Aureal\\A3D", 0, 0x2001F, &hKey))
+  if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Aureal\\A3D", 0, KEY_READ|KEY_WOW64_32KEY, &hKey))
   {
     int Aureal3D_SplashAudio = 0;
     if (query)
@@ -2552,8 +2554,6 @@
   void *v9; // eax@8
   int v12; // [sp+1Ch] [bp-8h]@1
 
-  //__debugbreak();//Ritor1
-
   if ( this->b3DSoundInitialized )
   {
     //v5 = &this->uNum3DSamples;
@@ -2612,7 +2612,7 @@
     if ( pSounds[i].pSoundData == _this )
     {
       free(_this);
-      memset(&pSounds[i], 0, 0x80u);
+      memset(&pSounds[i], 0, sizeof(pSounds[i]));
     }
   }