[Ida Script] Vanilla - MOP menu

Shout-Out

User Tag List

Results 1 to 1 of 1
  1. #1
    Makkah's Avatar Active Member Authenticator enabled
    Reputation
    45
    Join Date
    Jun 2024
    Posts
    67
    Thanks G/R
    10/29
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    [Ida Script] Vanilla - MOP

    Hello everyone,

    I found this script on OwnedCore and wanted to provide an updated version that supports multiple expansions, from Vanilla to Mists of Pandaria (MoP). This enhanced script is designed to dump Lua functions across all these patches, which can be a huge help for anyone interested in working with these specific game versions.

    It's an IDC script intended for use in IDA (Interactive Disassembler), allowing you to extract and rename Lua functions from various patches of the game efficiently. Whether you're working on a project for research, modding, or just exploring how Lua functions are implemented across different WoW expansions, this script should make the process much smoother.

    Hopefully, it comes in handy for anyone looking to work with these patches!

    This will work on x86, i will update post once i finish 64bit versions from MOP onword.
    Code:
    #include <idc.idc>
    
    static RenameFunc( dwAddress, sFunction )
    {
    	auto dwRet;
        auto part = substr( GetFunctionName( dwAddress ), 0, 7 );
        
        if ( part != "Script_" )
        {
            auto oldName = GetFunctionName( dwAddress );
            dwRet = MakeNameEx( dwAddress, sFunction, SN_NOWARN );
    
            if( dwRet == 0 )
            {
                auto sTemp, i;
                for( i = 1; i < 32; i++ )
                {
                    sTemp = form( "%s_%i", sFunction, i );
    
                    if( ( dwRet = MakeNameEx( dwAddress, sTemp, SN_NOWARN ) ) != 0 )
                        break;
                } 
            }
            else if (oldName != "")
                Message("Lua function renamed: '%s' -> '%s'\n", oldName, sFunction);
    
        }
    	
    	return dwRet;	
    }
    
    static Luafunc_GetName( structAddr )
    {
    	return GetString( Dword( structAddr ), -1, ASCSTR_C );
    }
    
    static Luafunc_GetFunc( structAddr )
    {
    	return Dword( structAddr + 4 );
    }
    
    static HandleLuaFunc( structBase )
    {
     	auto funcName, funcAddr;
        
    	funcName = Luafunc_GetName( structBase );
    	funcAddr = Luafunc_GetFunc( structBase );	
        RenameFunc( funcAddr, form( "Script_%s", funcName ) );
    }
    
    static RenameLuaFunctionsByReference(registerFunc, structBaseOffset, numFuncOffset)
    {
        auto xRef;
        if(registerFunc == BADADDR)
        {
            Warning("You do not have a function 0x%x\n");
            return;
        }
    	
    	for( xRef = RfirstB( registerFunc ); xRef != BADADDR; xRef = RnextB( registerFunc, xRef ) )
    	{
    		auto structBase;
            auto numFuncs, i;
               
    		structBase = Dword(xRef - structBaseOffset);
    		numFuncs = GetOperandValue( xRef + numFuncOffset, 1 ) / 4;
             if(numFuncs == 0)
                numFuncs = 1;
    
            //Message( "xref 0x%x - structBase 0x%x - numfuc %d\n",xRef, structBase, numFuncs);
            
    		if ( numFuncs < 1000 && numFuncs > 0)
    		{   
    			for ( i = 0; i < numFuncs; i++ )
    			{
                    HandleLuaFunc(structBase);
    				structBase = structBase + 0x4;
    				
    			}	
    		}
    	}
    }
    
    // Vanilla 1.12.1
    // luaRegister = 0x704120;
    // structBaseOffset = 0x4;
    // numFuncOffset = 0x8;
    
    
    // TBC 2.4.3
    // luaRegister = 0x7059B0;
    // structBaseOffset = 0x6;
    // numFuncOffset = 0xB;
    
    
    // WOTLK 3.3.5A
    // luaRegister = 0x817F90;
    // structBaseOffset = 0x6;
    // numFuncOffset = 0xB;
    
    
    // Cata 4.3.4
    // luaRegister = 0x83B030;
    // structBaseOffset = 0x6;
    // numFuncOffset = 0xB;
    
    
    // MOP 5.4.8
    // luaRegister = 0x44ED93;
    // structBaseOffset = 0x4;
    // numFuncOffset = 0xA;
    
    
    static main()
    {
    	RenameLuaFunctionsByReference(0x44ED93, 0x4, 0xA);
    }

    [Ida Script] Vanilla - MOP
  2. Thanks Corthezz (1 members gave Thanks to Makkah for this useful post)

Similar Threads

  1. IDA script / plugin
    By violentmagician in forum WoW Memory Editing
    Replies: 5
    Last Post: 09-19-2012, 06:19 PM
  2. [4.2.2+][mac] IDA Scripts - Dump Descriptors + label DBCs
    By Tanaris4 in forum WoW Memory Editing
    Replies: 5
    Last Post: 09-28-2011, 12:55 AM
  3. [IDA Script][Mac][4.1] Marking LUA functions
    By Tanaris4 in forum WoW Memory Editing
    Replies: 2
    Last Post: 04-23-2011, 12:37 AM
  4. IDA Scripts
    By kynox in forum WoW Memory Editing
    Replies: 20
    Last Post: 08-13-2009, 10:51 AM
  5. [IDA Script] Label Packet Handlers
    By kynox in forum WoW Memory Editing
    Replies: 5
    Last Post: 07-26-2009, 08:08 AM
All times are GMT -5. The time now is 07:33 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search