Hi,

I like to add the force feedback on games that don't support it.

To do this I was thinked to intercept when the game play some specific audio wav file (ex. collision.wav , damage.wav, connon.wav, etc..)

I have tried with a memory scanner to see when the audio file will load. Here a part of code:

Code:

            while (proc_min_address_l < proc_max_address_l)
            {
                // 28 = sizeof(MEMORY_BASIC_INFORMATION)
                VirtualQueryEx(processHandle, proc_min_address, out mem_basic_info, 28);

                // if this memory chunk is accessible
                if (mem_basic_info.Protect == PAGE_READWRITE && mem_basic_info.State == MEM_COMMIT && (mem_basic_info.lType == MEM_MAPPED || mem_basic_info.lType == MEM_PRIVATE))
                {
                    byte[] buffer = new byte[mem_basic_info.RegionSize];

                    // read everything in the buffer above
                    ReadProcessMemory((int)processHandle, mem_basic_info.BaseAddress, buffer, mem_basic_info.RegionSize, ref bytesRead);

                    string result = System.Text.Encoding.ASCII.GetString(buffer);

                    if (resul*****ntains(TextToFind))
                        MatchCount++;

                    // then output this in the file
                    //for (int i = 0; i < mem_basic_info.RegionSize; i++)
                    //    sw.WriteLine("0x{0} : {1}", (mem_basic_info.BaseAddress + i).ToString("X"), (char)buffer[i]);
                }

                // move to the next memory chunk
                proc_min_address_l += mem_basic_info.RegionSize;
                proc_min_address = new IntPtr(proc_min_address_l);
            }
unfortunatenly there is a problem, this code work only the first time, becouse in the memory when the time pass there are multiple match of 'TextToFind' (MatchCount) so it is not easy to detect when the game play again a wav file.

So I have thinked a solution like this:

for each memory scan I load a temp stucture array that contain information of every match (wav_name and base_address) ex:

Code:
Arr[0].FileName='Collision.wav';
Arr[0].BaseAdress= 54354646;

Arr[1].FileName='Collision.wav';
Arr[1].BaseAdress= 67576575;

Arr[2].FileName='Collision.wav';
Arr[2].BaseAdress= 354664;
after every scan I can do a check like this:

Code:
if (Updated_Array != Previous_Array_Copy)
  // the wav file was load
theorically this work ? Or there is another easy way to do this ?

thanks !!