Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


A Simple Game Trainer Template With Protection

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Sep 05, 2015 9:02 pm    Post subject: A Simple Game Trainer Template With Protection Reply with quote

Case closed

Last edited by Corroder on Tue Sep 08, 2015 8:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
lolAnonymous
Expert Cheater
Reputation: 1

Joined: 19 Jul 2015
Posts: 154

PostPosted: Sat Sep 05, 2015 9:14 pm    Post subject: Reply with quote

Corrorder I Am Very Glad To See Your Script

Thank U For This But I Want To Ask A Simple Question Is There Any Method To Convert .mp3 To .xm ??

Thank U In Advance... Smile
Back to top
View user's profile Send private message
Rydian
Grandmaster Cheater Supreme
Reputation: 31

Joined: 17 Sep 2012
Posts: 1358

PostPosted: Sat Sep 05, 2015 9:44 pm    Post subject: Reply with quote

MP3 is an audio recording, XM is a tracker format.
They're not exactly interchangable.

_________________
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Sep 05, 2015 9:56 pm    Post subject: Reply with quote

There are a function to add mp3 and playing in a CE Trainer.
or its able to change mp3 file to WAV file and next change again to XM file with use media converter.

But the file will bigger in bytes size and CE (I think ) not able to play the sound. (I have tried it and not work and don;t know what is wrong).

Anyhow here is a function to play MP3 sound by a track. You can trace this in a other post in this forum, about play MP3 sound.



Code:

-- fix MemoryStream write, and add other useful methods
if oldcreateMemoryStream==nil then oldcreateMemoryStream = createMemoryStream end
function createMemoryStream()
  local obj = oldcreateMemoryStream()
  local oldwrite=obj.write

  obj.write = function (t,n)  -- override default write
              local count=0
              for _,v in ipairs(t) do
                if count==n then break end
                oldwrite({v},1)
                count=count+1
              end
            end

  obj.writeDword = function (v) obj.write(dwordToByteTable(v)) end
  obj.writeWord = function (v) obj.write(wordToByteTable(v)) end

  return obj
end

header = {
0x46464952,0x00000000,0x45564157,0x20746D66,0x0000001E,0x00020055,
0x0000AC44,0x00000020,0x00000001,0x0001000C,0x00000002,0x00010001,
0x61660571,0x00047463,0x2FF80000,0x61640014
} -- 44100Hz  , Stereo

--convertMP3ToRIFFMP3(stream, stereo, rate)
--convertMP3ToRIFFMP3(stream) == convertMP3ToRIFFMP3(stream, true, 44100)
--convertMP3ToRIFFMP3(stream, false) == convertMP3ToRIFFMP3(stream, false, 44100)
function convertMP3ToRIFFMP3(stream, stereo, rate)
  local riffmp3 = createMemoryStream()
  for i,v in ipairs(header) do riffmp3.writeDword(v) end

  riffmp3.writeWord(0x6174)
  riffmp3.writeDword(stream.Size)
  riffmp3.copyFrom(stream,stream.Size)

  riffmp3.Position = 0x4; riffmp3.writeDword(stream.Size+0x24)

  if stereo==false then riffmp3.Position = 0x16; riffmp3.writeWord(1) end
  if tonumber(rate) then riffmp3.Position = 0x18; riffmp3.writeDword(rate) end

  riffmp3.Position = riffmp3.Size - 1
  return riffmp3
end


if oldplaySound==nil then oldplaySound=playSound end

function playSound(track, ...)
  if track==nil then return end

  local stream
  if track.ClassName=='TMemoryStream' then stream=track else stream=track.Stream end

  if streamSwapTable==nil then streamSwapTable = {} end

  local ID=userDataToInteger(stream)
  if streamSwapTable[ID]~=nil then oldplaySound(streamSwapTable[ID], ...) return end

  stream.Position = 0
  if table.concat(stream.read(4),'-')=='73-68-51-4' then
    -- found mp3 file, converting
    -- convertMP3ToRIFFMP3(stream, stereo, rate)
    stream.Position = 0
    local riffmp3 = convertMP3ToRIFFMP3(stream, true, 32000)  -- ADJUST THIS LINE
    streamSwapTable[ID]=riffmp3
    oldplaySound(riffmp3, ...)
  else
    -- other file (wav)
    streamSwapTable[ID]=stream
    oldplaySound(stream, ...)
  end
end

-- TRACK ENDS HERE

--- Next to play mp3 sound, need put the function under button / box functions as ON / OFF

Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8585
Location: 127.0.0.1

PostPosted: Tue Sep 08, 2015 1:47 pm    Post subject: Reply with quote

Keep in mind by posting the protection code you make use of, it kind of makes it pointless protection at that point. People can see how you are blocking things now and just bypass it with ease.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Tue Sep 08, 2015 8:12 pm    Post subject: Reply with quote

You're absolutely right atom0s, I am just try to give a simple example how to protect against game trainer (although in fact , the protection is very weak or can be said useless).

However, the purpose of this is so that CE users (newbies, same like me) can develop the trainer scripts and perform in accordance with the protection of their own volition.

Thank you for your constructive criticism.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Sep 10, 2015 8:32 am    Post subject: Reply with quote

Btw. my old mp3 to riffmp3 converter do not accept some mp3 files. I'm working on newer version.
_________________
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu Sep 10, 2015 9:42 pm    Post subject: Reply with quote

Got the new update of your mp3 (play sound function)
Thanks a lot mgr.inz.Player
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8585
Location: 127.0.0.1

PostPosted: Fri Sep 11, 2015 5:28 pm    Post subject: Reply with quote

Locking this since the OP deleted the first post.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites