Exemple #1
0
file_error emu_file::open_next()
{
    // if we're open from a previous attempt, close up now
    if (m_file != NULL)
        close();

    // loop over paths
    file_error filerr = FILERR_NOT_FOUND;
    while (m_iterator.next(m_fullpath, m_filename))
    {
        // attempt to open the file directly
        filerr = core_fopen(m_fullpath, m_openflags, &m_file);
        if (filerr == FILERR_NONE)
            break;

        // if we're opening for read-only we have other options
        if ((m_openflags & (OPEN_FLAG_READ | OPEN_FLAG_WRITE)) == OPEN_FLAG_READ)
        {
            astring tempfullpath = m_fullpath;

            filerr = attempt__7zped();
            if (filerr == FILERR_NONE)
                break;

            m_fullpath = tempfullpath;

            filerr = attempt_zipped();
            if (filerr == FILERR_NONE)
                break;


        }
    }
    return filerr;
}
Exemple #2
0
osd_file::error emu_file::open_next()
{
	// if we're open from a previous attempt, close up now
	if (m_file != nullptr)
		close();

	// loop over paths
	osd_file::error filerr = osd_file::error::NOT_FOUND;
	while (m_iterator.next(m_fullpath, m_filename.c_str()))
	{
		// attempt to open the file directly
		filerr = util::core_file::open(m_fullpath, m_openflags, m_file);
		if (filerr == osd_file::error::NONE)
			break;

		// if we're opening for read-only we have other options
		if ((m_openflags & (OPEN_FLAG_READ | OPEN_FLAG_WRITE)) == OPEN_FLAG_READ)
		{
			std::string tempfullpath = m_fullpath;

			filerr = attempt_zipped();
			if (filerr == osd_file::error::NONE)
				break;

			m_fullpath = tempfullpath;

			filerr = attempt__7zped();
			if (filerr == osd_file::error::NONE)
				break;
		}
	}
	return filerr;
}
Exemple #3
0
file_error emu_file::open_next()
{
	// if we're open from a previous attempt, close up now
	if (m_file != NULL)
		close();

	// loop over paths
	file_error filerr = FILERR_NOT_FOUND;
	while (m_iterator.next(m_fullpath, m_filename))
	{
		// attempt to open the file directly
		filerr = core_fopen(m_fullpath, m_openflags, &m_file);
		if (filerr == FILERR_NONE)
			break;

		// if we're opening for read-only we have other options
		if ((m_openflags & (OPEN_FLAG_READ | OPEN_FLAG_WRITE)) == OPEN_FLAG_READ)
		{
			astring tempfullpath = m_fullpath;

			filerr = attempt__7zped();
			if (filerr == FILERR_NONE)
				break;

			m_fullpath = tempfullpath;

			filerr = attempt_zipped();
			if (filerr == FILERR_NONE)
				break;

//FIXME
#if 0
			// mamep: load zipped inp file
			{
				astring zipped_fullname;
				int offset = 0;
				int n = m_filename.rchr(offset, '.');
    
				if (n > 0)
					offset = n;
    
				zipped_fullname.cpy(m_filename, offset);
				zipped_fullname.cat(PATH_SEPARATOR);
				zipped_fullname.cat(m_filename);
    
				filerr = fopen_attempt_zipped(m_filename, crc, openflags, &m_file);

				if (filerr == FILERR_NONE)
					break;
			}
#endif

		}
	}
	return filerr;
}