rendered paste body/*I know this code is ugly, was a quick hacky job.Include directories:..\..\public, ..\..\public\tier0, ..\..\public\tier1, ..\..\public\tier2, ..\..\public\tier3, ..\..\public\commonLinker commandline:/LIBPATH:"..\..\lib\public" tier0.lib tier1.lib tier2.lib tier3.lib-----argv[2] is expected to be a script file (.txt) that defines the mdlkeyvalues, example:mdlkeyvalue{prop_data {"base" "Pottery.Small" }}The script must look like a compiled one as seen above.These are extremely similar to a QC file's $keyvalues,you can probably just replace the "$keyvalues" with "mdlkeyvalue" and it should work.Propdata types and values can be found here: http://developer.valvesoftware.com/wiki/Prop_Data*/#if _MSC_VER >= 1300#pragma warning( disable : 4996 ) //Unsafe function bullshit#endif#include "studio.h"#define MDLKEYVALUES_MAXSIZE 16384 //16kb should be more than enough#define ALIGN4( a ) a = (byte*)((int)((byte*)a + 3) & ~ 3) //4byte alignmentint main( int argc, char *argv[] ){ if( argc != 3 ) { printf( "Usage: %s modelfile.mdl keyvalsfile.blah\n", argv[0] ); return 1; } if( !strstr( argv[1], ".mdl" ) ) { printf( "%s is not a model file!\n", argv[1] ); return 2; } FILE *fp = fopen( argv[1], "rb" ); if( !fp ) { printf( "Couldn't open %s\n", argv[1] ); return 3; } fseek( fp, 0, SEEK_END ); int length = ftell( fp ); fseek( fp, 0, SEEK_SET ); char *buffer = new char[length+MDLKEYVALUES_MAXSIZE]; memset( buffer, 0, length+MDLKEYVALUES_MAXSIZE ); fread( buffer, 1, length, fp ); fclose( fp ); //For alignment byte *pData = (byte*)buffer; byte *pStart = (byte*)buffer; studiohdr_t *phdr = (studiohdr_t*)buffer; Studio_ConvertStudioHdrToNewVersion( phdr ); if( phdr->keyvaluesize != 0 ) { printf( "%s already has keyvalues, aborting..\n", phdr->name ); delete[] buffer; return 4; } if( phdr->flags & STUDIOHDR_FLAGS_STATIC_PROP ) phdr->flags &= ~STUDIOHDR_FLAGS_STATIC_PROP; //remove staticprop flag char *pszPropdata = new char[MDLKEYVALUES_MAXSIZE]; memset( pszPropdata, 0, MDLKEYVALUES_MAXSIZE ); FILE *fpKeyvals = fopen( argv[2], "rb" ); if( !fpKeyvals ) { printf( "Couldn't open %s!\n", argv[2] ); delete[] pszPropdata; delete[] buffer; return 5; } fseek( fpKeyvals, 0, SEEK_END ); int propdatalen = ftell( fpKeyvals ); fseek( fpKeyvals, 0, SEEK_SET ); fread( pszPropdata, 1, propdatalen, fpKeyvals ); fclose( fpKeyvals ); if( propdatalen == 0 || memcmp( pszPropdata, "mdlkeyvalue", 11 ) != 0 ) { printf( "No mdlkeyvalues found in %s!\n", argv[2] ); delete[] pszPropdata; delete[] buffer; return 6; } memcpy( buffer+length, pszPropdata, propdatalen ); pData += ( length + propdatalen ); ALIGN4( pData ); phdr->keyvalueindex = phdr->length; phdr->keyvaluesize = propdatalen; phdr->length = (pData - pStart); fp = fopen( argv[1], "wb" ); fwrite( phdr, 1, phdr->length, fp ); fclose( fp ); delete[] buffer; delete[] pszPropdata; return 0;}