1 /* 2 * fileio.c 3 * 4 * Load a normal file, or ZIP/GZ archive into ROM buffer. 5 * Returns loaded ROM size (zero if an error occured). 6 * 7 * Copyright Eke-Eke (2007-2014), based on original work from Softdev (2006) 8 * 9 * Redistribution and use of this code or any derivative works are permitted 10 * provided that the following conditions are met: 11 * 12 * - Redistributions may not be sold, nor may they be used in a commercial 13 * product or activity. 14 * 15 * - Redistributions that are modified from the original source must include the 16 * complete source code, including the source code for all components used by a 17 * binary built from the modified sources. However, as a special exception, the 18 * source code distributed need not include anything that is normally distributed 19 * (in either source or binary form) with the major components (compiler, kernel, 20 * and so on) of the operating system on which the executable runs, unless that 21 * component itself accompanies the executable. 22 * 23 * - Redistributions must reproduce the above copyright notice, this list of 24 * conditions and the following disclaimer in the documentation and/or other 25 * materials provided with the distribution. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * POSSIBILITY OF SUCH DAMAGE. 38 * 39 ****************************************************************************************/ 40 41 #ifndef _FILEIO_H_ 42 #define _FILEIO_H_ 43 44 /* Function prototypes */ 45 int load_archive(char *filename, unsigned char *buffer, int maxsize, char *extension); 46 47 #endif /* _FILEIO_H_ */ 48