void CCSuperAnim::removeTimeEvent(const std::string &theLabel, int theEventId){
	if (HasSection(theLabel) == false) {
		CCAssert(false, "Label not existed.");
		return;
	}
	LabelNameToTimeEventInfoArrayMap::iterator anIter = mLabelNameToTimeEventInfoArrayMap.find(theLabel);
	if (anIter != mLabelNameToTimeEventInfoArrayMap.end()) {
		TimeEventInfoArray &aTimeEventInfoArray = anIter->second;
		for (TimeEventInfoArray::iterator i = aTimeEventInfoArray.begin(); i != aTimeEventInfoArray.end(); i++) {
			if (i->mEventId == theEventId) {
				aTimeEventInfoArray.erase(i);
				break;
			}
		}
	}
	
	// also remove in the current time event info array
	for (TimeEventInfoArray::iterator i = mCurTimeEventInfoArray.begin(); i != mCurTimeEventInfoArray.end(); i++) {
		if (i->mLabelName == theLabel &&\
			i->mEventId == theEventId) {
			mCurTimeEventInfoArray.erase(i);
			break;
		}
	}
}
Example #2
0
plKeysAndValues plConfigInfo::GetSection(const std::string & section, bool & found)
{
    found = HasSection(section);
    if (found)
        return fSections[section.c_str()];
    else
        return plKeysAndValues(); // empty
}
// for time event
void CCSuperAnim::registerTimeEvent(const std::string &theLabel, float theTimeFactor, int theEventId){
	if (HasSection(theLabel) == false) {
		CCAssert(false, "Label not existed.");
		return;
	}
	
	theTimeFactor = clampf(theTimeFactor, 0.0f, 1.0f);
	TimeEventInfo aTimeEventInfo = {theLabel, theTimeFactor, theEventId};
	TimeEventInfoArray &aTimeEventInfoArray = mLabelNameToTimeEventInfoArrayMap[theLabel];
	aTimeEventInfoArray.push_back(aTimeEventInfo);
}
Example #4
0
bool plConfigInfo::HasKeyIn(const std::string & key, const std::vector<std::string> & sections )
{
    for ( int i=0; i<sections.size(); i++ )
    {
        const char * section = sections[i].c_str();
        if (HasSection(section))
        {
            if (fSections[section].HasKey(key))
                return true;
        }
    }
    return false;
}
Example #5
0
double plConfigInfo::GetValueIn(const std::string & key, double defval, bool * outFound, const std::vector<std::string> & sections ) const
{
    if (outFound) *outFound=false;
    for ( int i=0; i<sections.size(); i++ )
    {
        if (HasSection(sections[i]))
        {
            plKeysAndValues & kv = fSections[sections[i].c_str()];
            if (kv.HasKey(key))
                return kv.GetValue(key,defval,outFound);
        }
    }
    return defval;
}
Example #6
0
double plConfigInfo::GetValueIn(const std::string & key, double defval, bool * outFound, const char * section1, ...) const
{
    if (outFound) *outFound=false;
    const char * section = section1;
    va_list sections;
    va_start(sections,section1);
    while (section)
    {
        if (HasSection(section))
        {
            plKeysAndValues & kv = fSections[section];
            if (kv.HasKey(key))
                return kv.GetValue(key,defval,outFound);
        }
        section = va_arg(sections,const char *);
    }
    va_end(sections);
    return defval;
}
void TestExeFile( const char *pFilename, PIMAGE_DOS_HEADER dosHeader )
{
	PIMAGE_NT_HEADERS pNTHeader;
	
	pNTHeader = MakePtr( PIMAGE_NT_HEADERS, dosHeader,
								dosHeader->e_lfanew );

	// First, verify that the e_lfanew field gave us a reasonable
	// pointer, then verify the PE signature.
	if ( IsBadReadPtr(pNTHeader, sizeof(IMAGE_NT_HEADERS)) ||
	     pNTHeader->Signature != IMAGE_NT_SIGNATURE )
	{
		printf("Unhandled EXE type, or invalid .EXE (%s)\n", pFilename);
		return;
	}

	if ( HasSection( (PIMAGE_SECTION_HEADER)(pNTHeader+1), pNTHeader->FileHeader.NumberOfSections, "ValveDBG" ) )
	{
		printf("%s is a debug build\n", pFilename);
	}
}
Example #8
0
std::vector<std::string> plConfigInfo::GetAllValuesIn(const std::string & key, const char * section1, ...)
{
    const char * section = section1;
    va_list sections;
    va_start(sections,section1);
    std::vector<std::string> result;
    while (section)
    {
        if (HasSection(section))
        {
            plKeysAndValues & kv = fSections[section];
            if (kv.HasKey(key))
            {
                std::vector<std::string> values = kv.GetAllValues(key);
                result.insert(result.end(),values.begin(),values.end());
            }
        }
        section = va_arg(sections,const char *);
    }
    va_end(sections);
    return result;
}
Example #9
0
/**
 * @brief Main Entry Point
 *
 * @param argc      The number of arguments passed to this application.
 * @param argv      The array of arguments passed to this application.
 *
 * @return Non-important return value.
 */
int __cdecl main(int argc, char* argv[])
{
    // Display our project header..
    Console::output(Console::Colors::LightPurple, "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
    Console::output(Console::Colors::LightPurple, "-=-");
    Console::output(Console::Colors::LightCyan, "                 Steamless - Steam DRM Remover v1.0              ");
    Console::output(Console::Colors::LightPurple, "-=-\n");
    Console::output(Console::Colors::LightPurple, "-=-");
    Console::output(Console::Colors::LightYelllow, "                    by atom0s [[email protected]]                  ");
    Console::output(Console::Colors::LightPurple, "-=-\n");
    Console::output(Console::Colors::LightPurple, "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n");

    // Ensure the argument count is valid..
    if (argc <= 1)
    {
        Console::output(Console::Colors::LightRed, "[*] ERROR: Invalid usage!\n");
        Console::output(Console::Colors::LightRed, "[*] ERROR: Usage is: Steamless.exe [file]\n");
        return 0;
    }

    // Ensure the given file exists..
    if (::GetFileAttributes(argv[1]) == INVALID_FILE_ATTRIBUTES)
    {
        Console::output(Console::Colors::LightRed, "[*] ERROR: Invalid input file; file does not exist!\n");
        return 0;
    }

    // Set the current working directory to the given input file..
    char szWorkingDirectory[MAX_PATH] = { 0 };
    strcpy_s(szWorkingDirectory, argv[1]);
    ::PathRemoveFileSpec(szWorkingDirectory);

    if (strlen(szWorkingDirectory) > 0)
        ::SetCurrentDirectory(szWorkingDirectory);

    // Load the input file for processing..
    auto file = new PEFile();
    if (!file->Initialize(argv[1]))
    {
        Console::output(Console::Colors::LightRed, "[*] ERROR: Failed to initialize PEFile wrapper. Invalid file maybe?\n");
        delete file;
        return 0;
    }

    // Determine if the file has the proper .bind section..
    if (!file->HasSection(".bind"))
    {
        Console::output(Console::Colors::LightRed, "[*] ERROR: Failed to locate .bind section, cannot process file!\n");
        delete file;
        return 0;
    }

    // Attempt to process the file..
    auto processed = [&]() -> bool
    {
        // Locate a known Steam signature by scanning for stub information..
        for (auto x = 0; x < _countof(g_Signatures); x++)
        {
            auto found = Utils::FindPattern((unsigned char*)file->GetDataPointer(), file->GetDataSize(), g_Signatures[x].Pattern, g_Signatures[x].Mask);
            if (found != 0)
            {
                Console::output(Console::Colors::LightGreen, "[*] INFO: Located Steam Stub! (%s)\n", g_Signatures[x].Name);
                return g_Signatures[x].Func(file, argv[1]);
            }
        }

        return false;
    }();

    if (!processed)
        Console::output(Console::Colors::LightRed, "[*] ERROR: Failed to process file!\n");
    else
        Console::output(Console::Colors::LightGreen, "[*] Successfully processed the file!\n");

    // Cleanup..
    delete file;
    file = nullptr;
    return 0;
}