예제 #1
0
파일: OS2.cpp 프로젝트: Maximus5/FarPlugins
// Get an ASCII string representing a resource type
void GetOS2ResourceTypeName(DWORD type, PSTR buffer, UINT cBytes)
{
	if ((type & 0x8000) == 0x8000) {
		GetResourceTypeName(type & 0x7FFF, buffer, cBytes-10);
		strcat(buffer, " [16bit]");
	} else {
		GetResourceTypeName(type, buffer, cBytes);
	}
}
void CHLSL_Solver_ReadSemantics::OnVarInit( const WriteContext_FXC &context )
{
	const ResourceType_t &type = GetResourceType();
	const char *varname = GetResourceTypeName( type );
	CHLSL_Var *target = GetTargetVar( 0 );
	char tmp[MAXTARGC];
	Q_snprintf( tmp, MAXTARGC, "In.%s", varname );
	target->SetName( tmp, true );
}
void CHLSL_Solver_ReadSemantics::OnWriteFXC( bool bIsPixelShader, WriteContext_FXC &context )
{
	const ResourceType_t &type = GetResourceType();
	const char *varname = GetResourceTypeName( type );
	const char *semanticsname = GetSemanticTypeName( type );
	const char *semanticdatatype = GetSemanticType( type );

	const bool bIsTexCoord = ( type >= RESOURCETYPE_TEXCOORD_0 && type <= RESOURCETYPE_TEXCOORD_7 );
	const bool bIsColor = ( type >= RESOURCETYPE_COLOR_0 && type <= RESOURCETYPE_COLOR_3 );

	char tmp[MAXTARGC];
	if ( bIsPixelShader && ( bIsTexCoord || bIsColor ) )
		//semanticdatatype = GetVarCodeNameFromFlag( pInfo->_IntValue_0 );
		semanticdatatype = GetVarCodeNameFromFlag( GetData()._IntValue_0 );
	else if ( !bIsPixelShader )
	{
		if ( bIsTexCoord )
		{
			int typenum = type - RESOURCETYPE_TEXCOORD_0;
			Assert( typenum >= 0 && typenum < 3 );
			semanticdatatype = GetVarCodeNameFromFlag( vs_setup.iDataTypeFlag_TexCoords[typenum] );
		}
		else if ( bIsColor )
		{
			int typenum = type - RESOURCETYPE_COLOR_0;
			Assert( typenum >= 0 && typenum < 3 );
			semanticdatatype = GetVarCodeNameFromFlag( vs_setup.iDataTypeFlag_Color[typenum] );
		}
	}

	Q_snprintf( tmp, MAXTARGC, "%s %s", semanticdatatype, varname );
	int tabsWorth = StringTabsWorth( tmp );
	Q_snprintf( tmp, MAXTARGC, "\n%s %s", semanticdatatype, varname );
	context.buf_semantics_In.PutString( tmp );

	for ( int i = 6 - tabsWorth; i >= 0; i-- )
		context.buf_semantics_In.PutString( "\t" );

	Q_snprintf( tmp, MAXTARGC, ":\t%s;", semanticsname  );
	context.buf_semantics_In.PutString( tmp );
}
예제 #4
0
파일: resdump.cpp 프로젝트: martell/pedump
//
// Dump the information about one resource directory.
//
void DumpResourceDirectory
(
    PIMAGE_RESOURCE_DIRECTORY resDir,
    DWORD resourceBase,
    DWORD level,
    DWORD resourceType
)
{
    PIMAGE_RESOURCE_DIRECTORY_ENTRY resDirEntry;
    char szType[64];
    UINT i;

    // Level 1 resources are the resource types
    if ( level == 1 )
    {
		printf( "    ---------------------------------------------------"
	            "-----------\n" );

		if ( resourceType & IMAGE_RESOURCE_NAME_IS_STRING )
		{
			GetResourceNameFromId( resourceType, resourceBase,
									szType, sizeof(szType) );
		}
		else
		{
	        GetResourceTypeName( resourceType, szType, sizeof(szType) );
		}
	}
    else    // All other levels, just print out the regular id or name
    {
        GetResourceNameFromId( resourceType, resourceBase, szType,
                               sizeof(szType) );
    }
	    
    // Spit out the spacing for the level indentation
    for ( i=0; i < level; i++ )
        printf("    ");

    printf(
        "ResDir (%s) Entries:%02X (Named:%02X, ID:%02X) TimeDate:%08X",
        szType, resDir->NumberOfNamedEntries+ resDir->NumberOfIdEntries,
        resDir->NumberOfNamedEntries, resDir->NumberOfIdEntries,
        resDir->TimeDateStamp );
        
	if ( resDir->MajorVersion || resDir->MinorVersion )
		printf( " Vers:%u.%02u", resDir->MajorVersion, resDir->MinorVersion );
	if ( resDir->Characteristics)
		printf( " Char:%08X", resDir->Characteristics );
	printf( "\n" );

	//
	// The "directory entries" immediately follow the directory in memory
	//
    resDirEntry = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(resDir+1);

	// If it's a stringtable, save off info for future use
	if ( level == 1 && (resourceType == (WORD)RT_STRING))
	{
		pStrResEntries = resDirEntry;
		cStrResEntries = resDir->NumberOfIdEntries;
	}

	// If it's a stringtable, save off info for future use
	if ( level == 1 && (resourceType == (WORD)RT_DIALOG))
	{
		pDlgResEntries = resDirEntry;
		cDlgResEntries = resDir->NumberOfIdEntries;
	}
	    
    for ( i=0; i < resDir->NumberOfNamedEntries; i++, resDirEntry++ )
        DumpResourceEntry(resDirEntry, resourceBase, level+1);

    for ( i=0; i < resDir->NumberOfIdEntries; i++, resDirEntry++ )
        DumpResourceEntry(resDirEntry, resourceBase, level+1);
}