-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- customSound = {} customSound.numberOfTracks = 0 customSound.everythingOK = false customSound.by = 'mgr.inz.Player' function customSound.Init(soundTable) if soundTable==nil or type(soundTable)~="table" then return false end customSound.numberOfTracks = 0 local addresses='' for index,tableFile in ipairs(soundTable) do local tableFile = findTableFile(tableFile) if tableFile~=nil then --local address = userDataToInteger(tableFile.Stream) --local direct_address = readIntegerLocal(address+4) local direct_address = tableFile.Stream.Memory addresses = addresses .. 'dq (int)' .. direct_address .. '\n' customSound.numberOfTracks = customSound.numberOfTracks + 1 end end local callingConvention = '' if cheatEngineIs64Bit() then callingConvention = [[push rbp mov rbp,rsp sub rsp,30 mov rax,[00400500] mov r8d,5 mov rdx,0 mov rcx,[rax*8+00400600] call winmm.PlaySoundA leave ret]] else callingConvention = [[push ebp mov ebp,esp mov eax,[00400500] push 5 push 0 push [eax*8+00400600] call winmm.PlaySoundA leave ret]] end local aas=[[ fullaccess(00400500,1024) 00400508: ]]..callingConvention..[[ 00400600: ]]..addresses..[[ ]] local old_onOpenProcess=onOpenProcess; onOpenProcess=nil; local OK=autoAssemble([[ loadlibrary(winmm.dll) ]],true) local OK=autoAssemble(aas,true) customSound.everythingOK = OK onOpenProcess=old_onOpenProcess end function customSound.PlaySound(trackNumber) if not customSound.everythingOK then return false end if trackNumber < 1 then return false end if trackNumber > customSound.numberOfTracks then return false end local old_onOpenProcess=onOpenProcess; onOpenProcess=nil; autoAssemble([[ createthread(00400508) 00400500: dq (int)]]..(trackNumber-1)..[[ ]] ,true) onOpenProcess=old_onOpenProcess end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --------------------------------------------------------------------------------