Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
Is there any "recording game software tutorial"
Results 1 to 10 of 10

Thread: Is there any "recording game software tutorial"

  1. #1
    Senior Member
    Join Date
    Nov 2010
    Posts
    397

    Is there any "recording game software tutorial"

    I can imagine darkstar jumping on this thread saying " jah !!! theres open source cams and shitt and you cant figure out " well "thanks for passing by"
    now i will love to see a tutorial on recording programs, im actually working on 1, with ofcourse an open source, trying to make it able to tibia and any other game, wich is kind of an imposible task, or you just collect all the packages from every single game available or you just record the screen as avi or any other format, eigther way im not good explaining, and i will love to understant how the collector or whatever you could call it, works with "tibia"

    if any1 would be so kind to write 1, from 0 to hero ill appreciate it and ill probably donate him some bucks for helping out the community and giving us the chance to learn about it, "some threads and users should be able to collect donations, i can see how the forum grown bit by bit since neobot died, and theres always the same questions, and the same answer "look it yourself", "you cant do it", "anything blaster says", dont get me wrong i love Blaster <3, but hes almost on every single post bashing newbies that honestly cant even search in google, and for those people learn to do a simple calculator before you persuit anything else.


    -pardon my dislexia and awful grammar-[hr]
    right i said im working with an open source, it is : http://code.google.com/p/snes9x-gtk/downloads/list it has the best recording program i have ever seen
    also : http://forum.freegamedev.net/viewforum.php?f=3 i recomend checking for game develop forums, sadly most of them have this "search, wont tell you, its easy but i wont give u the answer" and so on, so get the info you need but dont ask anything unless you want some really stupid answer....

  2. #2
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191

    RE: Is there any "recording game software tutorial"



    So you're trying to make a recorder for Tibia? It's not too difficult, especially if you're just going to proxy the client and store the packets.
    I did write one a while back, but it's horribly maintained and reeks of messy code, but if you want to wade through it anyway, here you go (note that this is for 7.72, so you'd need to edit a few things):
    TibiaCam.cs
    [code=c#]
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Net;
    using System.Net.Sockets;
    using System.Threading;

    namespace TibianicTools.Objects
    {
    class TibiaCam
    {
    /// <summary>
    /// Constructor for playback.
    /// </summary>
    internal TibiaCam()
    {
    this.Mode = TibiaCamMode.Playback;
    this.PlaybackSpeed = 1.0;
    }
    /// <summary>
    /// Constructor for recording.
    /// </summary>
    /// <param name="loginServer">The login server to connect to.</param>
    internal TibiaCam(LoginServer loginServer)
    {
    this.Mode = TibiaCamMode.Record;
    this.ServerInfo = loginServer;
    this.RecordingStopwatch = new System.Diagnostics.Stopwatch();
    this.CachedCharacterList = new List<CharacterList.Player>();
    }

    #region get-set properties
    internal uint[] XteaKey { get; set; }
    internal Recording CurrentRecording { get; set; }
    internal LoginServer ServerInfo { get; set; }
    internal TibiaCamMode Mode { get; set; }
    internal ushort ListenerPort { get; set; }
    internal string PreferredFileName { get; set; }
    internal double PlaybackSpeed { get; set; }
    internal bool AutoRecord { get; set; }
    internal bool AutoPlayback { get; set; }
    internal bool DoKillAfterPlayback { get; set; }
    private TcpClient TcpClientLocal { get; set; }
    private TcpClient TcpClientServer { get; set; }
    private bool isRunning { get; set; }
    internal bool IsRunning { get { return this.isRunning; } }
    /// <summary>
    /// Used to reset character list when closing.
    /// </summary>
    private List<CharacterList.Player> CachedCharacterList { get; set; }
    private System.Diagnostics.Stopwatch RecordingStopwatch { get; set; }
    private int CurrentPacket { get; set; }
    private TimeSpan FastForwardTo { get; set; }
    private bool DoFastForward { get; set; }
    /// <summary>
    /// Used to reset the login servers when closing.
    /// </summary>
    private List<LoginServer> ServerInfoOld = new List<LoginServer>();
    private Thread threadPlaybackSend { get; set; }
    private Thread threadPlaybackSendMouse { get; set; }
    #endregion

    #region methods
    internal void Start()
    {
    this.isRunning = true;
    switch (this.Mode)
    {
    case TibiaCamMode.Playback:
    break;
    case TibiaCamMode.Record:
    this.CurrentRecording = new Recording(Settings.Tibiacam.Recorder.doRecordMouse );
    break;
    }
    this.ServerInfoOld = Client.Misc.GetLoginServers();
    Thread t = new Thread(new ThreadStart(HandleTcpRequests));
    t.Start();
    if (this.AutoPlayback)
    {
    Thread tLogin = new Thread(new ThreadStart(delegate() { Client.Misc.Login(0, string.Empty, "TibiaCam"); }));
    tLogin.Start();
    }
    }

    internal void Stop()
    {
    this.isRunning = false;
    if (this.ServerInfoOld.Count > 0) Client.Misc.SetLoginServers(this.ServerInfoOld);
    if (this.CachedCharacterList != null && this.CachedCharacterList.Count > 0) Client.Charlist.WriteIP(this.CachedCharacterList);
    switch (this.Mode)
    {
    case TibiaCamMode.Playback:
    if (this.TcpClientLocal != null) this.TcpClientLocal.Close();
    if (this.threadPlaybackSend != null && this.threadPlaybackSend.IsAlive) this.threadPlaybackSend.Abort();
    if (this.DoKillAfterPlayback && !Client.Tibia.HasExited) Client.Tibia.Kill();
    break;
    case TibiaCamMode.Record:
    if (this.CurrentRecording != null && this.CurrentRecording.ContainsData()) this.CurrentRecording.Save(this.PreferredFileName) ;
    this.RecordingStopwatch.Stop();
    break;
    }
    }

    /// <summary>
    /// Handles incoming TCP connection requests and sets the login servers. Should be run on its own thread.
    /// </summary>
    private void HandleTcpRequests()
    {
    TcpListener listener = null;
    for (ListenerPort = 7000; ListenerPort < 7500; ListenerPort++)
    {
    try
    {
    listener = new TcpListener(IPAddress.Loopback, ListenerPort);
    listener.Start();
    break;
    }
    catch { continue; }
    }
    if (listener == null || this.ListenerPort == 7500) return;
    Client.Misc.SetLoginServers(new List<LoginServer>() { new LoginServer(IPAddress.Loopback.ToString(), ListenerPort) });
    while (isRunning)
    {
    while (!listener.Pending()) Thread.Sleep(100);
    TcpClientLocal = listener.AcceptTcpClient();
    Thread t;
    switch (this.Mode)
    {
    case TibiaCamMode.Playback:
    t = new Thread(new ThreadStart(PlaybackRecv));
    t.Start();
    break;
    case TibiaCamMode.Record:
    t = new Thread(new ThreadStart(HandleTcpLocal));
    t.Start();
    break;
    }
    }
    listener.Stop();
    }

    #region Recording
    /// <summary>
    /// Handles the local Tibia client connection. Should be run on its own thread.
    /// </summary>
    private void HandleTcpLocal()
    {
    try
    {
    if (TcpClientLocal == null) return;
    NetworkStream nstream = TcpClientLocal.GetStream();
    int connection = 0;
    bool obtainedXteaKey = false;

    while (true)
    {
    Objects.Packet p = Objects.Packet.GetNextPacket(nstream);
    if (p.Length == 0) break;

    if (!obtainedXteaKey)
    {
    if (Client.TibiaVersion >= 770)
    {
    this.XteaKey = new uint[4];
    for (int i = 0; i < 4; i++) this.XteaKey[i] = Memory.ReadUInt(Addresses.Client.XTEAKey + i * 4);
    }
    obtainedXteaKey = true;
    }

    if (connection != 8)
    {
    connection = Memory.ReadByte(Addresses.Client.Connection);
    if (connection == 6) // connecting to gameserver
    {
    try
    {
    byte index = Memory.ReadByte(Addresses.Charlist.SelectedIndex);
    if (index < 0 || index >= this.CachedCharacterList.Count) break; // invalid index
    CharacterList.Player player = this.CachedCharacterList[index];
    TcpClientServer = new TcpClient(player.IP, player.Port);
    Thread t = new Thread(new ThreadStart(HandleTcpServer));
    t.Start();
    Thread.Sleep(20); // give thread time to start
    }
    catch { break; }
    }
    else if (connection > 0 && connection < 6) // connecting to login server, not sure exactly what value it should be
    {
    try
    {
    this.TcpClientServer = new TcpClient(this.ServerInfo.IP, this.ServerInfo.Port);
    Thread t = new Thread(new ThreadStart(HandleTcpServer));
    t.Start();
    Thread.Sleep(20); // give thread time to start
    }
    catch { break; } // couldn't connect to server
    }
    }
    p.Send(this.TcpClientServer);

    try
    {
    if (Client.TibiaVersion >= 770) p = p.XteaDecrypt(this.XteaKey, 2);
    ushort len = p.GetUInt16();
    byte packetType = p.GetByte();
    if (!Settings.Tibiacam.Recorder.Filters.OutgoingPriva teMessages && packetType == 0x96 && Client.TibiaVersion == 740)
    {
    if (p.GetByte() != 0x04) continue;
    Objects.Packet pm = new Objects.Packet();
    pm.AddByte((byte)Addresses.Enums.IncomingPacketTyp es.CreatureSpeech);
    string recipient = p.GetString();
    pm.AddString(recipient);
    pm.AddByte(0x04);
    string msg = p.GetString();
    pm.AddString("» " + msg);
    pm.AddLength();
    //Objects.Packet temp = new Objects.Packet();
    //temp.AddUInt32((uint)this.RecordingStopwatch.Elaps edMilliseconds);
    //temp.AddUInt32((uint)pm.Length);
    //temp.AddBytes(pm.ToBytes());
    CurrentRecording.Packets.Add(new Recording.Packet((uint)this.RecordingStopwatch.Ela psedMilliseconds, pm.ToBytes()));
    }
    }
    catch { }
    }
    if (this.TcpClientLocal != null) this.TcpClientLocal.Close();
    if (this.TcpClientServer != null) this.TcpClientServer.Close();
    }
    catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message + "\n" + ex.StackTrace); }
    }

    private void HandleTcpServer()
    {
    try
    {
    if (TcpClientServer == null) return;
    NetworkStream nstream = TcpClientServer.GetStream();
    int connection = 0;
    bool changeCharacterList = false, sentAnimatedTextPacket = false;
    while (true)
    {
    Objects.Packet p = Objects.Packet.GetNextPacket(nstream);
    if (p.Length == 0) break;

    if (connection != 8) connection = Memory.ReadByte(Addresses.Client.Connection);
    if (connection == 3)
    {
    changeCharacterList = true;
    Memory.WriteByte(Addresses.Charlist.NumberOfCharac ters, 0);
    }
    else if (connection > 5 && this.IsRunning)
    {
    if (connection == 8 && !sentAnimatedTextPacket)
    {
    Objects.Packet animPacket = new Objects.Packet();
    animPacket.AddByte((byte)Addresses.Enums.IncomingP acketTypes.AnimatedText);
    animPacket.AddUInt16(Client.Player.X);
    animPacket.AddUInt16(Client.Player.Y);
    animPacket.AddByte(Client.Player.Z);
    animPacket.AddByte(181);
    animPacket.AddString("Recording!");
    animPacket.AddLength();
    if (Client.TibiaVersion >= 770) { animPacket.XteaEncrypt(this.XteaKey); animPacket.AddLength(); }
    animPacket.Send(TcpClientLocal);
    sentAnimatedTextPacket = true;
    }
    if (!this.RecordingStopwatch.IsRunning) this.RecordingStopwatch.Start();
    if (this.CurrentRecording.MouseRecording != null && !this.CurrentRecording.MouseRecording.IsRecording)
    {
    this.CurrentRecording.MouseRecording.StartRecordin g();
    }
    Objects.Packet temp = new Objects.Packet();
    //temp.AddUInt32((uint)this.RecordingStopwatch.Elaps edMilliseconds);
    if (Client.TibiaVersion >= 770)
    {
    Objects.Packet decryptedPacket = p.XteaDecrypt(this.XteaKey, 2);
    //temp.AddUInt32((uint)decryptedPacket.Length);
    temp.AddBytes(decryptedPacket.ToBytes());
    }
    else
    {
    //temp.AddUInt32((uint)p.Length);
    temp.AddBytes(p.ToBytes());
    }
    this.CurrentRecording.Packets.Add(new Recording.Packet((uint)this.RecordingStopwatch.Ela psedMilliseconds, temp.ToBytes()));
    this.CurrentRecording.TimePassed = (uint)this.RecordingStopwatch.ElapsedMilliseconds;
    }
    p.Send(this.TcpClientLocal);
    }

    if (changeCharacterList)
    {
    changeCharacterList = false;
    for (int i = 0; i < 100; i++)
    {
    if (Memory.ReadInt(Addresses.Client.DialogOpen) > 0 &&
    Memory.ReadByte(Addresses.Charlist.NumberOfCharact ers) > 0)
    {
    this.CachedCharacterList = CharacterList.GetPlayers();
    Client.Charlist.WriteIP("127.0.0.1", this.ListenerPort);
    break;
    }
    else if (Memory.ReadInt(Addresses.Client.DialogOpen) > 0 &&
    Client.Misc.DialogTitle == "Enter Game")
    {
    break;
    }
    Thread.Sleep(100);
    }
    }

    if (this.TcpClientLocal != null) this.TcpClientLocal.Close();
    if (this.TcpClientServer != null) this.TcpClientServer.Close();
    }
    catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message + "\n" + ex.StackTrace); }
    }
    #endregion

    #region Playback
    internal void FastForward(TimeSpan ts)
    {
    if (this.CurrentRecording == null) return;
    if (this.threadPlaybackSend == null || !this.threadPlaybackSend.IsAlive) return;
    this.FastForwardTo = ts;
    this.DoFastForward = true;
    if (this.threadPlaybackSend.ThreadState == ThreadState.WaitSleepJoin) this.threadPlaybackSend.Interrupt();
    }

    private void PlaybackSend()
    {
    try
    {
    Recording.Packet p;
    this.CurrentPacket = 0;
    this.DoFastForward = false;
    uint timeOld = 0, timeNew = 0;
    bool hasShownInfo = false;
    this.CurrentRecording.TimePassed = 0;
    if (this.CurrentRecording.MouseRecording != null)
    {
    while (this.threadPlaybackSendMouse != null && this.threadPlaybackSendMouse.IsAlive) { this.threadPlaybackSendMouse.Abort(); Thread.Sleep(100); }
    this.threadPlaybackSendMouse = new Thread(new ThreadStart(this.PlaybackSendMouse));
    threadPlaybackSendMouse.Start();
    }

    try
    {
    while (this.CurrentPacket < this.CurrentRecording.Packets.Count)
    {
    if (!this.TcpClientLocal.Connected) return;

    if (this.DoFastForward)
    {
    if (TimeSpan.FromMilliseconds(this.CurrentRecording.T imePassed) > this.FastForwardTo) { this.CurrentPacket = 0; this.CurrentRecording.TimePassed = 0; }
    while (this.CurrentPacket < this.CurrentRecording.Packets.Count &&
    this.CurrentRecording.TimePassed < this.FastForwardTo.TotalMilliseconds)
    {
    p = this.CurrentRecording.Packets[this.CurrentPacket].Clone();
    this.CurrentRecording.TimePassed = p.Time;
    //if (this.CurrentRecording.Recorder == Enums.Recorder.TibianicTools) p.GetPosition += 4;
    //else if (this.CurrentRecording.Recorder == Enums.Recorder.TibiaMovie) p.GetPosition += 2;
    if (Client.TibiaVersion >= 770) p = p.XteaEncrypt(this.XteaKey, 0);
    p.Send(this.TcpClientLocal);
    this.CurrentPacket++;
    }
    this.DoFastForward = false;
    hasShownInfo = false;
    }
    else if (this.PlaybackSpeed <= 0) { Thread.Sleep(200); continue; }

    if (/*Client.TibiaVersion == 740 && */!hasShownInfo && this.CurrentPacket > 3 && Client.Player.Connected)
    {
    Thread.Sleep(100);
    Objects.Packet packet = new Objects.Packet();
    packet.AddByte(0xb4); // text message
    packet.AddByte(16); // orange color
    packet.AddString("Welcome to a Tibianic Tools recording!\nKeyboard hotkeys:\nArrow keys - change playback speed\nBackspace - rewind 1 minute");
    packet.AddByte(0xb4);
    packet.AddByte(16);
    packet.AddString("Text commands:\ninfo - show recording information\ngoto hh:mm:ss - rewinds/fast forwards to given time\npause - pauses playback\nresume - resumes playback");
    packet.AddLength();
    if (Client.TibiaVersion >= 770) { packet.XteaEncrypt(this.XteaKey, packet.GetPosition); packet.AddLength(); }
    packet.Send(this.TcpClientLocal);

    hasShownInfo = true;
    Thread.Sleep(20);
    }

    p = this.CurrentRecording.Packets[this.CurrentPacket].Clone();
    this.CurrentRecording.TimePassed = p.Time;
    timeNew = this.CurrentRecording.TimePassed;
    int sleep = (int)((timeNew - timeOld) / this.PlaybackSpeed);
    //if (this.CurrentRecording.Recorder == Enums.Recorder.TibianicTools) p.GetPosition += 4; // length, not needed
    //else if (this.CurrentRecording.Recorder == Enums.Recorder.TibiaMovie) p.GetPosition += 2; // -||-
    // try-catch because Thread.Interrupt() will throw an exception
    try { if (sleep > 0) Thread.Sleep(sleep); }
    catch { }
    if (!this.TcpClientLocal.Connected) return;
    if (Client.TibiaVersion >= 770)
    {
    p = p.XteaEncrypt(this.XteaKey, 0);
    }
    p.Send(this.TcpClientLocal);
    if (this.CurrentRecording.MouseRecording != null)
    {
    MouseRecording mouseRec = this.CurrentRecording.MouseRecording;
    //int currentTime = mouseRec.Seek(this.CurrentRecording.TimePassed);
    int mouseTime = mouseRec.CurrentIndex * mouseRec.Interval;
    int timeMarginMax = mouseTime + 200, timeMarginMin = mouseTime - 200;
    if (timeNew >= timeMarginMax || timeNew <= timeMarginMin)
    {
    this.CurrentRecording.MouseRecording.CurrentIndex = this.CurrentRecording.MouseRecording.Seek(timeNew) ;
    }
    }
    timeOld = timeNew;
    this.CurrentPacket++;
    }
    }
    catch { }
    Thread.Sleep(3000);
    this.PlaybackSpeed = 1;
    WinApi.SetWindowText(Client.Tibia.MainWindowHandle , "Tibia");
    if (TcpClientLocal != null) TcpClientLocal.Close();
    if (this.DoKillAfterPlayback && !Client.Tibia.HasExited) Client.Tibia.Kill();
    else this.AutoPlayback = false;
    }
    catch (Exception ex) { /*System.Windows.Forms.MessageBox.Show(ex.Message + "\n" + ex.StackTrace);*/ }
    }
    private void PlaybackSendMouse()
    {
    try
    {
    Recording rec = this.CurrentRecording;
    if (rec == null) return;
    MouseRecording mouseRec = null;
    if (this.CurrentRecording.MouseRecording != null) mouseRec = this.CurrentRecording.MouseRecording;
    else return;

    mouseRec.CurrentIndex = 0;
    while (this.IsRunning && this.TcpClientLocal.Connected)
    {
    if (this.threadPlaybackSend == null || !this.threadPlaybackSend.IsAlive) return;
    while (this.PlaybackSpeed <= 0) { Thread.Sleep(200); continue; }
    //int currentTime = mouseRec.Seek(this.CurrentRecording.TimePassed);
    //int mouseTime = i * mouseRec.Interval;

    Objects.Packet p = mouseRec.Packets[mouseRec.CurrentIndex];
    p.GetPosition = 0;
    MouseRecording.DataType dt = (MouseRecording.DataType)p.GetByte();
    switch (dt)
    {
    case MouseRecording.DataType.ClientWindowChange:
    break;
    case MouseRecording.DataType.GameWindowChange:
    break;
    case MouseRecording.DataType.MouseXY:
    int percentX = p.GetByte(), percentY = p.GetByte();
    if (percentX == 0 && percentY == 0) break;
    if (WinApi.GetForegroundWindow() != Client.Tibia.MainWindowHandle) break;
    System.Drawing.Point point = mouseRec.CalculateScreenMouseXY(new System.Drawing.Point(percentX, percentY));
    System.Windows.Forms.Cursor.Position = point;
    break;
    }
    p.GetPosition = 0;
    mouseRec.CurrentIndex++;
    Thread.Sleep((int)(mouseRec.Interval / this.PlaybackSpeed));
    }
    }
    catch { }
    }

    private void PlaybackRecv()
    {
    try
    {
    NetworkStream nstream = TcpClientLocal.GetStream();
    int connection = 0;
    bool doLoop = true, obtainedXteaKey = false;

    while (doLoop)
    {
    Objects.Packet p = Objects.Packet.GetNextPacket(nstream);
    if (p.Length == 0) break;

    if (!obtainedXteaKey)
    {
    if (Client.TibiaVersion >= 770)
    {
    this.XteaKey = new uint[4];
    for (int i = 0; i < 4; i++) this.XteaKey[i] = Memory.ReadUInt(Addresses.Client.XTEAKey + i * 4);
    }
    obtainedXteaKey = true;
    }

    connection = Memory.ReadByte(Addresses.Client.Connection);
    switch ((Enums.Connection)connection)
    {
    case Enums.Connection.WaitingForCharacterList:
    if (this.AutoPlayback)
    {
    p = new Objects.Packet();
    p.AddByte(0x64);
    p.AddByte(1);
    p.AddString("TibiaCam");
    p.AddString(CurrentRecording.TibiaVersion);
    p.AddBytes(IPAddress.Loopback.GetAddressBytes());
    p.AddUInt16(this.ListenerPort);
    p.AddUInt16(0); // premium days
    p.AddLength();
    if (Client.TibiaVersion >= 770) { p.XteaEncrypt(this.XteaKey); p.AddLength(); }
    p.Send(this.TcpClientLocal);
    doLoop = false;
    break;
    }

    List<string> files = new List<string>();
    foreach (string kcam in System.IO.Directory.GetFiles(System.Windows.Forms. Application.StartupPath + "\\", "*.kcam"))
    {
    files.Add(kcam);
    }
    foreach (string iryontcam in System.IO.Directory.GetFiles(System.Windows.Forms. Application.StartupPath + "\\", "*.cam"))
    {
    files.Add(iryontcam);
    }
    if (Settings.Tibiacam.Playback.SupportTibiaMovies)
    {
    foreach (string tmv in System.IO.Directory.GetFiles(System.Windows.Forms. Application.StartupPath + "\\", "*.tmv"))
    {
    files.Add(tmv);
    }
    }
    files.Sort();
    string warning = string.Empty;
    int count = files.Count;
    if (files.Count > 255) { warning = "\n\nWarning! There are " + files.Count + " recordings.\nOnly the first 255 recordings are listed."; count = 255; }
    p = new Objects.Packet();
    p.AddByte(0x14); // motd type
    // motd id is 0-255, which is followed by a newline (\n)
    p.AddString((byte)new Random().Next(255) + "\nThank you for using Tibianic Tools.\nhttp://code.google.com/p/tibianic-tools/\nhttp://tibianic.org/" + warning);
    p.AddByte(0x64); // character list type
    List<Recording> recordings = new List<Recording>();
    for (int i = 0; i < count; i++)
    {
    Recording r = new Recording(files[i], Settings.Tibiacam.Playback.ReadMetaData, false, false);
    if (!r.isCorrupt) recordings.Add(r);
    }
    p.AddByte((byte)count); // amount of characters
    foreach (Recording r in recordings)
    {
    p.AddString(r.FileNameShort); // character name
    p.AddString(r.TibiaVersion); // server name
    p.AddBytes(IPAddress.Loopback.GetAddressBytes()); // server ipv4 (in this case: 127.0.0.1)
    p.AddUInt16(this.ListenerPort); // server port
    }
    p.AddUInt16((ushort)count); // premium days
    p.AddLength();
    if (Client.TibiaVersion >= 770) { p.XteaEncrypt(this.XteaKey); p.AddLength(); }
    p.Send(TcpClientLocal);
    doLoop = false;
    break;
    case Enums.Connection.ConnectingGameServer:
    if (this.AutoPlayback)
    {
    this.threadPlaybackSend = new Thread(new ThreadStart(PlaybackSend));
    this.threadPlaybackSend.Start();
    break;
    }
    CharacterList.Player player = CharacterList.GetPlayers()[Memory.ReadByte(Addresses.Charlist.SelectedIndex)];
    if (!System.IO.File.Exists(player.Name)) { System.Windows.Forms.MessageBox.Show(player.Name + "\ndoes not exist", "Error"); doLoop = false; break; }
    Recording rec = new Recording(player.Name, true, true, Settings.Tibiacam.Playback.doPlayMouse);
    if (rec.isCorrupt || !rec.ContainsData()) { System.Windows.Forms.MessageBox.Show(player.Name + "\nappears to be corrupt or it doesn't contain any data", "Error"); doLoop = false; break; }
    this.CurrentRecording = rec;
    while (this.threadPlaybackSend != null && this.threadPlaybackSend.IsAlive) { this.threadPlaybackSend.Abort(); Thread.Sleep(100); }
    while (this.threadPlaybackSendMouse != null && this.threadPlaybackSendMouse.IsAlive) { this.threadPlaybackSendMouse.Abort(); Thread.Sleep(100); }
    this.threadPlaybackSend = new Thread(new ThreadStart(PlaybackSend));
    this.threadPlaybackSend.Start();
    break;
    case Enums.Connection.Online:
    ushort len = p.GetUInt16();
    if (Client.TibiaVersion >= 770)
    {
    p = p.XteaDecrypt(this.XteaKey, 2);
    if (p == null) break;
    p.GetPosition = 2;
    }
    byte type = p.GetByte();
    switch (type)
    {
    case 0x14: // logout
    while (this.threadPlaybackSend != null && this.threadPlaybackSend.IsAlive) { this.threadPlaybackSend.Abort(); Thread.Sleep(100); }
    this.TcpClientLocal.Close();
    return;
    case 0x96: // player speech
    byte speechType = p.GetByte();
    if (speechType < 1 || speechType > 3) break;
    string msg = p.GetString().ToLower();
    string[] msgSplit = msg.Split(' ');
    p = new Objects.Packet();
    switch (msgSplit[0])
    {
    case "info":
    p.AddByte(0xb4);
    p.AddByte(22);
    p.AddString("Tibia version: " + this.CurrentRecording.TibiaVersion + "\nRecorder version: " + this.CurrentRecording.RecorderVersion + "\n# of packets: " + this.CurrentRecording.Packets.Count);
    p.AddLength();
    if (Client.TibiaVersion >= 770) { p.XteaEncrypt(this.XteaKey, p.GetPosition); p.AddLength(); }
    p.Send(this.TcpClientLocal);
    break;
    case "goto":
    TimeSpan ts;
    if (!TimeSpan.TryParse(msgSplit[1], out ts)) break;
    this.FastForward(ts);
    break;
    case "pause":
    this.PlaybackSpeed = 0;
    break;
    case "resume":
    this.PlaybackSpeed = 1;
    break;
    }
    break;
    }
    break;
    }
    }
    if (TcpClientLocal != null) TcpClientLocal.Close();
    }
    catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message + "\n" + ex.StackTrace); if (TcpClientLocal != null) TcpClientLocal.Close(); }
    }
    #endregion

    #endregion

    internal enum TibiaCamMode
    {
    Undefined = 0,
    Playback = 1,
    Record = 2
    }
    }
    }
    [/code]

    edit: seems the post got cut off due to excessive length, so here's Recording.cs: http://pastebin.com/ZkqnPDt5

  3. #3
    Senior Member
    Join Date
    Mar 2007
    Posts
    367

    RE: Is there any "recording game software tutorial"

    anything blaster says

    The best/easiest approach would be, like Blaster said, to catch packets and store them (could be encrypted so noone messes with recordings).
    Either that or record part of a screen prefferably chosen by user and storing as avi or w/e fits best.

    This mostly depends on the programmer skills and what he preffers doing - one can feel better with recording AVIs, other with catching packets (like me :P).
    One *BIG* pro for packets is the size of a recording - AVIs tend to be big in size, thus problematic at hosting and w/e.

    offtopic
    OMG Blaster I never realised You are the maker of TibianicTools :blush::blush::blush:

  4. #4
    Senior Member
    Join Date
    Nov 2010
    Posts
    397

    RE: Is there any "recording game software tutorial"

    well thanks blaster i just need to change it to .net or c++ XD
    anyways i will still want to see if any1 could do a tutorial searching in cheat engine and so on im asking this, because im using like 5 sources already, didnt really plan to do it for tibia but for league of legends, and i want to know how do you get the address from cheat engine or ollydbg the current lol recorder bugs or dosnt show the shop and so on....

    pain in the ass

  5. #5
    Junior Member
    Join Date
    Feb 2012
    Posts
    13

    RE: Is there any "recording game software tutorial"

    This writer works for version as global?
    And as a Tibiacam?

  6. #6
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191

    RE: Is there any "recording game software tutorial"

    Quote Originally Posted by Wesker
    well thanks blaster i just need to change it to .net or c++ XD
    anyways i will still want to see if any1 could do a tutorial searching in cheat engine and so on im asking this, because im using like 5 sources already, didnt really plan to do it for tibia but for league of legends, and i want to know how do you get the address from cheat engine or ollydbg the current lol recorder bugs or dosnt show the shop and so on....

    pain in the ass
    Well, there is no "universal" packet recorder+playback, as games have may have different encryption algorithms and other specifics that needs specific code.
    If you want a universal recorder, you're going to have to record the screen.

    Quote Originally Posted by Skyrr
    This writer works for version as global?
    And as a Tibiacam?
    If you meant my tibiacam; it's for 7.4-7.72. You should be able to make it work for whatever version Tibia uses now quite easily, as it doesn't bother with RSA at all (instead if writes to memory, slightly more unreliable, but a lot easier).

  7. #7
    Senior Member
    Join Date
    Nov 2010
    Posts
    397

    RE: Is there any "recording game software tutorial"

    Quote Originally Posted by Blaster_89

    Well, there is no "universal" packet recorder+playback, as games have may have different encryption algorithms and other specifics that needs specific code.
    If you want a universal recorder, you're going to have to record the screen.
    yup i knew that XD, problem is based on the codec can be better or worse for alot of things and involves how many tasks are you performing for example if you want to record league of legends with snagit the memory blows up, i wonder if theres any method to record the packages and reproduce them in another software, for example tibiacam had .rec or i think it had that, so if instead of collecting packages theres some method to collect the data or movements based on the screen of the game "without having to decode o decrypt/encrypt" i think im making a mess of this post....
    so if theres someway to record a part of the screen and maybe by-pass that file in a compressed .something you know like your doing it by bitmaps but saving them quickly into a compress file

    damm i did say im not good explaining things LOL
    well hope you understand it, if you didnt mm is there another method to get the packages without intrusion ?

  8. #8
    Junior Member
    Join Date
    Feb 2012
    Posts
    13

    RE: Is there any "recording game software tutorial"

    Look at this very pro css and recorder already running?
    Another thing he only write to him and read the file?: P

  9. #9
    Super Moderator
    Join Date
    May 2007
    Posts
    1,191

    RE: Is there any "recording game software tutorial"

    Quote Originally Posted by Wesker
    Quote Originally Posted by Blaster_89

    Well, there is no "universal" packet recorder+playback, as games have may have different encryption algorithms and other specifics that needs specific code.
    If you want a universal recorder, you're going to have to record the screen.
    yup i knew that XD, problem is based on the codec can be better or worse for alot of things and involves how many tasks are you performing for example if you want to record league of legends with snagit the memory blows up, i wonder if theres any method to record the packages and reproduce them in another software, for example tibiacam had .rec or i think it had that, so if instead of collecting packages theres some method to collect the data or movements based on the screen of the game "without having to decode o decrypt/encrypt" i think im making a mess of this post....
    so if theres someway to record a part of the screen and maybe by-pass that file in a compressed .something you know like your doing it by bitmaps but saving them quickly into a compress file

    damm i did say im not good explaining things LOL
    well hope you understand it, if you didnt mm is there another method to get the packages without intrusion ?
    Well, the problem with encoding video as you record is the performance hit. To gain performance while still encoding to save file size, you'll lose quality.
    Here's a test I made using VLC to record my screen, while encoding it to on-the-fly to h264 at a pretty low bitrate.

  10. #10
    Senior Member
    Join Date
    Nov 2010
    Posts
    397

    RE: Is there any "recording game software tutorial"

    mmm ill try that, your server is eigther far away or slow, im getting a hight ping in that video and the player gets stuck sometimes but i get your point

    ty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •