Tutorial Creating TU8 DLL

Sheperdebops

Code Junkie
Messages
78
Reaction score
73
Points
793
So before I begin this is only going be the basics and how to fully create your own look.
This is similar to GSC in some respect but its harder to get things to work like GSC so take your time with this.

You will need my Clean TU8 DLL now this is basically Se7enSins JTAG TU8 DLL but its been cleaned up and fixed bugs as well as corrected a few offsets which cause some crashs for some people so Credit to Him for this.
Download
You do not have permission to view link Log in or register now.

Starting out
  • Firstly Extract the folder some where nice where you wont lose it.
  • Double Click Sheperdebops TU8 Clean DLL.
  • Go through it all, read, take in the information as you will need to remember it in the Future.
Test
  • Build the solution and place the dll_load in your MW2 Folder on your JTAG/RGH make sure it runs
  • Done all that? Your Ready to begin.

So firstly where gonna create a Newsbar and a Typewriter Welcome Message for all clients that come in and join your game, so go to Main.cpp and look for BOOl WINAPI DllMain

where going to create a thread here as this way it wont interfere with any code

PHP:
BOOL WINAPI DllMain(HANDLE hInstDLL, DWORD reason, LPVOID lpReserved)
{
    if (reason == DLL_PROCESS_ATTACH)
    {
        Sleep(200);
        if (*(int*)(0x83109D9C) != 1)
            *(int*)(0x83109D9C) = 1;
        *(int*)(0x83109D80 + 0x1C) = 1;//Precaches Shaders So You Can Use All Different Shaders
        *(int*)(0x82168FB4) = 0x60000000;//Removes RSA Protection
        *(int*)(0x8216907C) = 0x60000000;//Nops Cheat Protectio
        *(int*)(0x821690F4) = 0x60000000;//Nops Cheat Protectio
        *(int*)(0x821D6E60) = 0x60000000;//Allows Walking In Game Timer And When Game Has Ended
        PatchInJump((DWORD*)0x823B64A4, (DWORD)XamHook, 0);
        PatchInJump((DWORD*)0x822531C8, (DWORD)SV_ExecuteClientCommandHook, 0);
    }
    return TRUE;
}

After the Sleep add this
PHP:
Createthread(0,0,StartIntro,0,0,0);

Now we need to create the function (Unliked GSC C++ has as define a function before it can call so you have to create this function above it like this)

PHP:
DWORD WINAPI StartIntro(LPVOID)
{
    for (;;)
    {
        if (Game.gameStarted)
        {
            for (int i = 0; i < 18; i++)
            {
                Welcome(i);
            }
        }
        Sleep(20);
    }
    Sleep(20);
}
BOOL WINAPI DllMain(HANDLE hInstDLL, DWORD reason, LPVOID lpReserved)
{
    if (reason == DLL_PROCESS_ATTACH)
    {
        Sleep(200);
        CreateThread(0, 0, Hook, 0, 0, 0);
        if (*(int*)(0x83109D9C) != 1)
            *(int*)(0x83109D9C) = 1;
        *(int*)(0x83109D80 + 0x1C) = 1;//Precaches Shaders So You Can Use All Different Shaders
        *(int*)(0x82168FB4) = 0x60000000;//Removes RSA Protection
        *(int*)(0x8216907C) = 0x60000000;//Nops Cheat Protectio
        *(int*)(0x821690F4) = 0x60000000;//Nops Cheat Protectio
        *(int*)(0x821D6E60) = 0x60000000;//Allows Walking In Game Timer And When Game Has Ended
        PatchInJump((DWORD*)0x823B64A4, (DWORD)XamHook, 0);
        PatchInJump((DWORD*)0x822531C8, (DWORD)SV_ExecuteClientCommandHook, 0);
    }
    return TRUE;
}

now that has been created il explain whats going on
the for loop is going from 0 - 18 the reason is its going to loop thought player[0] player[18] so everyone is calling this function basically

"Welcome" is the new function ( i ) and "i" is the for loop so everyone 20ms Welcome will be Welcome(0) - Welcome(18)

Now lets create our Welcome Function
PHP:
void Welcome(int clientIndex)
{
    if (Clients[clientIndex].JoinedGame)
    {
        if (Clients[clientIndex].Wel == false)
        {
            Sleep(2000);
            hudelem_color_t Welc;
            Welc.r = 255; Welc.g = 170; Welc.b = 0; Welc.a = 255;
            doTypewriterText(Hud[clientIndex].WelcomeMsg, LinkChar("Welcome ^1%s", (char*)getClientState(clientIndex) + 0x44), 100, 4000, 1000, Welc);
            doNewsBar(clientIndex);
            Clients[clientIndex].Wel = true;
        }

        NewsbarScroll(clientIndex);
    }
}

This will check if the player calling this function has joined the game
if True then it will check if they have been welcomed already using the bool Wel
if its false then it will create a welcome typewriter text and thread them to the newsbar
the newsbar forever loops which is why me made a separate thread.. this way it wont freeze the game allowing you to add more in to the patch.

Now before we go further we need to create some variables and alloc some hud Elems

so to this go to setup.h first
and look for this
PHP:
struct clientSettings_s
{

    bool JoinedGame;
    bool MenuOpen;
    bool MainMenu;
    int SubMenu;
    int Scroll;
    int ScrollMax;
    int VerificationStatus;
    float Movement;
    const char * Infoname;

    int mFlag;

    int PlayersMenu;
    int Player;
    int Client;

    void Reset()
    {
        JoinedGame = false;
        MenuOpen = false;
        MainMenu = false;
        SubMenu = 0;
        Scroll = 0;
        ScrollMax = 0;
        VerificationStatus = 0;
        mFlag = 0;
        Movement = 0;
        PlayersMenu = 0;
        Player = 0;
        Client = 0;
    }
}Clients[18];

this is all the variables that will be declared on a client and reset when they leave or the game ends
so lets add our Bool Wel

PHP:
// just add in below bool MainMenu (dont have to put it there it just keep them all organised)
bool Wel;

then under void Reset()

Wel = false;

The reason there is a a Reset it because its fixes the crash and unexpected handler error in the JTAG system therefore allowing you to just end game and start another.

Now lets create our Shaders and allocate them

go to

PHP:
struct hudElements_s
{


    void Reset()
    {

    }
}Hud[18];

and add these elements like this

PHP:
game_hudelem_s * WelcomeMsg;
game_hudelem_s * Newsbar;
game_hudelem_s * NewsbarText;

then in void Reset

WelcomeMsg = 0;
Newsbar =  0;
NewsbarText = 0;

should look like this

PHP:
struct clientSettings_s
{

    bool JoinedGame;
    bool MenuOpen;
    bool MainMenu;
    bool Wel;
    int SubMenu;
    int Scroll;
    int ScrollMax;
    int VerificationStatus;
    float Movement;
    const char * Infoname;

    int mFlag;

    int PlayersMenu;
    int Player;
    int Client;

    void Reset()
    {
        JoinedGame = false;
        MenuOpen = false;
        MainMenu = false;
        Wel = false;
        SubMenu = 0;
        Scroll = 0;
        ScrollMax = 0;
        VerificationStatus = 0;
        mFlag = 0;
        Movement = 0;
        PlayersMenu = 0;
        Player = 0;
        Client = 0;
    }
}Clients[18];

struct hudElements_s
{

    game_hudelem_s * WelcomeMsg;
    game_hudelem_s * Newsbar;
    game_hudelem_s * NewsbarText;

    void Reset()
    {
        WelcomeMsg = 0;
        Newsbar = 0;
        NewsbarText = 0;
    }
}Hud[18];

now we need to go to further down to struct Client

look for this bit here
PHP:
struct Client
{
private:
    int clientIndex;
public:
    Client(int client) { clientIndex = client; }
    gentity_s* GetEntity() { return getEntity(clientIndex); }

    bool playerConnected() { return GetEntity()->clientData->sess.Connect == 2 ? true : false; }
    bool Exist()
    {
        if (GetEntity()->clientData == 0)
            return false;
        else
            return GetEntity()->clientData->sess.Connect == CON_CONNECTED;
    }
    bool isHost() { return clientIndex == _Host() ? true : false; }
    bool isDead() { return GetEntity()->clientData->sess.sessionState == SESS_STATE_DEAD; }
    bool isPlaying() {
        return GetEntity()->clientData->sess.sessionState == SESS_STATE_PLAYING ? true : false;
    }
    void SetDvar(const char* dvar, const char* value) { SV(clientIndex, 0, LinkChar("s %s \"%s\"", dvar, value)); }
    const char* GetVerificationStatus()
    {
        if (Clients[clientIndex].VerificationStatus == 3)
            return "Status: ^3Host";
        else if (Clients[clientIndex].VerificationStatus == 2)
            return "Status: ^2VIP";
        else if (Clients[clientIndex].VerificationStatus == 1)
            return "Status: ^2Verified";
        else
            return "Status: ^1Unverified";
    }
    void DoUnlockAllCheevos()
    {
        XUSER_ACHIEVEMENT mw2Cheevos[50];
        for (int i = 0; i < 50; i++)
        {
            mw2Cheevos[i].dwUserIndex = 0;
            mw2Cheevos[i].dwAchievementId = gameAchievementList[i].achievementId;
        }

        XUserWriteAchievements_1(50, mw2Cheevos, &theOverlap);
        while (!XHasOverlappedIoCompleted(&theOverlap)) { Sleep(10); }
    }
    const char* GetNameWithStatus()
    {
        if (!Exist())
            return "...";
        else if (Clients[clientIndex].VerificationStatus == HOST)
            return LinkChar("^1[^5Host^1] %s", (char*)getClientState(clientIndex) + 0x44);
        else if (Clients[clientIndex].VerificationStatus == VERIFIED)
            return LinkChar("^1[^5Verified^1] %s", (char*)getClientState(clientIndex) + 0x44);
        else if (Clients[clientIndex].VerificationStatus == VIP)
            return LinkChar("^1[^5VIP^1] %s", (char*)getClientState(clientIndex) + 0x44);
        else
            return LinkChar("^1[^5Unverified^1] %s", (char*)getClientState(clientIndex) + 0x44);
    }
    void SetupClient()
    {
        SetDvar("loc_warnings", "0");
        SetDvar("loc_warningsUI", "0");
        SetDvar("g_hardcore", "1");
        DebugPrint("Client [%i] Has Joined The Game", clientIndex);
        if (clientIndex == _Host())
        {
            Clients[clientIndex].VerificationStatus = HOST;
            Game.HostGamertag = (char*)getClientState(_Host()) + 0x44;
            DebugPrint("Client [%i] Is Host And Gamertag Is: %s With Permission Privilages Of: %i", clientIndex, Game.HostGamertag, Clients[clientIndex].VerificationStatus);
        }
        else if (compareString((char*)getClientState(clientIndex) + 0x44, "freeB00T X3X"))
        {
            Clients[clientIndex].VerificationStatus = HOST;
            DebugPrint("Client [%i] Has Permission Privilages Of: %i", clientIndex, Clients[clientIndex].VerificationStatus);
        }
        else
        {
            Clients[clientIndex].VerificationStatus = UNVERIFIED;
            DebugPrint("Client [%i] Has Permission Privilages Of: %i", clientIndex, Clients[clientIndex].VerificationStatus);
        }
        if (*(int*)(0x83109D9C) != 1)
            *(int*)(0x83109D9C) = 1;
///////////////////////////////////
/////////////HERE//////////////////
///////////////////////////////////
        Clients[clientIndex].JoinedGame = true;
    }
    void ResetClient()
    {
        Hud[clientIndex].Reset();
        Clients[clientIndex].Reset();
    }
};
where ive put here you need to allocate your HUD Elems
so add this

PHP:
        Hud[clientIndex].WelcomeMsg = HudElem_Alloc(clientIndex, 0);
        Hud[clientIndex].Newsbar = HudElem_Alloc(clientIndex, 0);
        Hud[clientIndex].NewsbarText = HudElem_Alloc(clientIndex, 0);

This will Allocate each elem to every player NOW back to Main.cpp
now were going to create the movement now in the DLL i have left unlock all Achievements and a float called Movement this Movement its what we use for the Newsbar so you wont need to create a float called Movement

so above our Welcome function add this
PHP:
void doNewsBar(int client)
{
    setShader(Hud[client].Newsbar, "white", 320, 400, 1000, 30, 0x05, 1.0, 0, 0, 0, 180);
    Sleep(500);
    setText(Hud[client].NewsbarText, "^1<=> ^2Sheperdebops Lobbies ^1<=> ^7[ ^1Sheperdebops ^7- ^1Lobby Coder ^7] ^1<=> ^7[ ^1freeb00t X3X ^7- ^1Lobby Host ^7] ^1<=> ^7[ [{+actionslot 3}] ^7- ^1Open Menu ^7] ^1<=>", 4, 2, Clients[client].Movement, 400, 0x05, 1.1, 0, 0, 0, 255);
}
void NewsbarScroll(int client)
{
    Clients[client].Movement = (Clients[client].Movement - 1);
    ElemMove(Hud[client].NewsbarText, "x", Clients[client].Movement, .01);
    if (Clients[client].Movement == -1000)
    {
        Clients[client].Movement = 1500;
    }
}

you can edit the text to what ever you want but keep the parameters they will set it to the bottom of the screen and its moves at a nice speed very smoothly
PHP:
    setText(Hud[client].NewsbarText, "^1<=> ^2Sheperdebops Lobbies ^1<=> ^7[ ^1Sheperdebops ^7- ^1Lobby Coder ^7] ^1<=> ^7[ ^1freeb00t X3X ^7- ^1Lobby Host ^7] ^1<=> ^7[ [{+actionslot 3}] ^7- ^1Open Menu ^7] ^1<=>", 4, 2, Clients[client].Movement, 400, 0x05, 1.1, 0, 0, 0, 255);

Now during this you may of seen alot of this [client] [clientIndex]
well these are parameters remember the for loop i < 18
well that called called welcome like this
PHP:
for (int i = 0; i < 18; i++)
            {
                Welcome(i);
            }

void Welcome(int clientIndex) // Well the clientIndex is what ever i will be due to the parameter we set

////so it will check

if (Clients[clientIndex].JoinedGame)
or with the for loop
if (Clients[0].JoinedGame)
if (Clients[1].JoinedGame)
if (Clients[2].JoinedGame)
just like that basically it checks all 18 clients and tells all 18 clients what there system has to do via the DLL

quite clever really


I will update this over time ive wrote alot and my hands hurt :disappointed:

any problems let me know
 

arbus94

New Member
Messages
17
Reaction score
1
Points
3
would anyone like to help me? if ye so feel free to tweet me @xZarj so we can talk in dm´s

thanks in advance
 
Top