- #include <idc.idc>
- // 1 = Success, 0 = Failure
- static RenameFunc( dwAddress, sFunction )
- {
- auto dwRet;
- dwRet = MakeNameEx( dwAddress, sFunction, SN_NOWARN );
- if( dwRet == 0 )
- {
- auto sTemp, i;
- for( i = 0; i < 32; i++ )
- {
- sTemp = form( "%s_%i", sFunction, i );
- if( ( dwRet = MakeNameEx( dwAddress, sTemp, SN_NOWARN ) ) != 0 )
- {
- Message( "Info: Renamed to %s instead of %s\n", sTemp, sFunction );
- break;
- }
- }
- }
- return dwRet;
- }
- static LabelScripts( funcOffset )
- {
- auto xref;
- xref = RfirstB( funcOffset );
- do
- {
- auto nameArrPtr, funcArrPtr, funcName, iterVal, iterInc, iterMax;
- iterVal = 0;
- iterMax = GetOperandValue( NextHead ( NextHead( xref, NextFunction( xref ) ), NextFunction( xref ) ), 1);
- iterInc = GetOperandValue( NextHead ( xref, NextFunction( xref ) ), 1);
- nameArrPtr = GetOperandValue( PrevHead ( xref, PrevFunction( xref ) ), 1);
- funcArrPtr = GetOperandValue( PrevHead ( PrevHead( xref, PrevFunction( xref ) ), PrevFunction( xref ) ), 1);
- //Message("Name Array: %x Pointer Array: %x Iteration Increment: %d Iteration Max: %d\n", nameArrPtr, funcArrPtr, iterInc, iterMax);
- do
- {
- auto name, func;
- func = Dword( funcArrPtr + iterVal );
- name = GetString( Dword( nameArrPtr + iterVal ), -1, 0 );
- Message( "0x%08X \"Script_%s\"\n", func, name );
- MakeName( func, form( "Script_%s", name ) );
- iterVal = iterVal + iterInc;
- } while ( iterVal < iterMax );
- } while ( (xref = RnextB( funcOffset, xref )) != -1 );
- }
- #define FrameScript__RegisterFunction 0x00704120
- static main()
- {
- LabelScripts( FrameScript__RegisterFunction );
- }