Results 1 to 10 of 599

Thread: SAPP

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10

    Re: SAPP

    Like kornman said, quite a few functions use registers for one or more of their parameters, it's easier to just embed the assembly call in another function. The performance difference is basically non-existent.

    @sehe: That could cause the disconnects, if you bypass the queue you screw up the packet counters and they get out of sync. I used to have a proxy approach (2-3 years ago) but it was a really bad design and so I changed. Most of the relevant code is included, you should basically just need to to update the addresses. I only included the code I use for global messages (ie sv_say server messages). I just included the actual functions, didn't bother with their headers as you can just copy the declaration to one. I'll explain a bit of the code and if you still want some help, I added you on xfire and can send the whole project.

    1. Update addresses, there are only three that need updating. You can make that two if you're only interested in server messages, I have the third so I can handle all chat processing.
    2. Call the GlobalMessage function (ie GlobalMessage(L"your message, in wide char...")
    3. The first bit of GlobalMessage is just used for variable length parameters, WFormatVarArgs is just a memory safe wrapper around _vsnwprintf_s. I'm sure you have code for doing the same thing. It lets you call the function like GlobalMessage(L"Hello %s", player).
    4. The next bit just traverses the player list and sends the message to everyone in the server, (*itr)->memoryId is the player's memory id. I think other people call it their machine index or something. The game::ChatData struct is below, you may want to put byte alignment around it.

    Code:
    struct chatData
        {
            DWORD type;
            DWORD player;
            wchar_t* msg;
        };
    If you just want sv_say functionality you can basically get rid of DispatchChat and just put the calls to BuildPacket and AddToPlayerQueue in your GlobalMessage function.

    @ Patrickssj6, they probably can be type defined but I didn't really see the point.

    edit: no they can't, they use registers. See lines 95/96 for BuildPacket and 127/158 for the queue functions.
    Last edited by urbanyoung; September 22nd, 2011 at 04:59 PM.

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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