file_error emu_file::load__7zped_file() { assert(m_file == NULL); assert(m__7zdata == NULL); assert(m__7zfile != NULL); // allocate some memory m__7zdata = global_alloc_array(UINT8, m__7zlength); // read the data into our buffer and return _7z_error _7zerr = _7z_file_decompress(m__7zfile, m__7zdata, m__7zlength); if (_7zerr != _7ZERR_NONE) { global_free(m__7zdata); m__7zdata = NULL; return FILERR_FAILURE; } // convert to RAM file file_error filerr = core_fopen_ram(m__7zdata, m__7zlength, m_openflags, &m_file); if (filerr != FILERR_NONE) { global_free(m__7zdata); m__7zdata = NULL; return FILERR_FAILURE; } // close out the _7Z file _7z_file_close(m__7zfile); m__7zfile = NULL; return FILERR_NONE; }
file_error emu_file::load__7zped_file() { assert(m_file == NULL); assert(m__7zdata.count() == 0); assert(m__7zfile != NULL); // allocate some memory m__7zdata.resize(m__7zlength); // read the data into our buffer and return _7z_error _7zerr = _7z_file_decompress(m__7zfile, m__7zdata, m__7zdata.count()); if (_7zerr != _7ZERR_NONE) { m__7zdata.reset(); return FILERR_FAILURE; } // convert to RAM file file_error filerr = core_fopen_ram(m__7zdata, m__7zdata.count(), m_openflags, &m_file); if (filerr != FILERR_NONE) { m__7zdata.reset(); return FILERR_FAILURE; } // close out the _7Z file _7z_file_close(m__7zfile); m__7zfile = NULL; return FILERR_NONE; }
file_error emu_file::load__7zped_file() { assert(m_file == nullptr); assert(m__7zdata.empty()); assert(m__7zfile != nullptr); // allocate some memory m__7zdata.resize(m__7zlength); // read the data into our buffer and return _7z_error _7zerr = _7z_file_decompress(m__7zfile, &m__7zdata[0], m__7zdata.size()); if (_7zerr != _7ZERR_NONE) { m__7zdata.clear(); return FILERR_FAILURE; } // convert to RAM file file_error filerr = util::core_file::open_ram(&m__7zdata[0], m__7zdata.size(), m_openflags, m_file); if (filerr != FILERR_NONE) { m__7zdata.clear(); return FILERR_FAILURE; } // close out the _7Z file _7z_file_close(m__7zfile); m__7zfile = nullptr; return FILERR_NONE; }