Search
lxdream.org :: lxdream/src/loader.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/loader.h
changeset 1296:30ecee61f811
prev1109:700c5ab26a63
author nkeynes
date Fri May 29 18:47:05 2015 +1000 (7 years ago)
permissions -rw-r--r--
last change Fix test case
file annotate diff log raw
nkeynes@26
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@26
     3
 *
nkeynes@26
     4
 * Interface declarations for the binary loader routines (loader.c, elf.c)
nkeynes@26
     5
 *
nkeynes@26
     6
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@26
     7
 *
nkeynes@26
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@26
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@26
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@26
    11
 * (at your option) any later version.
nkeynes@26
    12
 *
nkeynes@26
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@26
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@26
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@26
    16
 * GNU General Public License for more details.
nkeynes@26
    17
 */
nkeynes@26
    18
nkeynes@736
    19
#ifndef lxdream_loader_H
nkeynes@736
    20
#define lxdream_loader_H 1
nkeynes@26
    21
nkeynes@26
    22
#include <stdio.h>
nkeynes@1296
    23
#include <glib.h>
nkeynes@26
    24
nkeynes@1108
    25
#include "drivers/cdrom/cdrom.h"
nkeynes@1108
    26
nkeynes@26
    27
#ifdef __cplusplus
nkeynes@26
    28
extern "C" {
nkeynes@26
    29
#endif
nkeynes@26
    30
nkeynes@26
    31
/** 
nkeynes@26
    32
 * NULL-terminated list of file extension/name pairs,
nkeynes@26
    33
 * supported by the loader 
nkeynes@26
    34
 */
nkeynes@26
    35
extern char *file_loader_extensions[][2];
nkeynes@26
    36
nkeynes@1109
    37
typedef enum {
nkeynes@1109
    38
    FILE_ERROR,
nkeynes@1109
    39
    FILE_BINARY,
nkeynes@1109
    40
    FILE_ELF,
nkeynes@1109
    41
    FILE_ISO,
nkeynes@1109
    42
    FILE_DISC,
nkeynes@1109
    43
    FILE_ZIP,
nkeynes@1109
    44
    FILE_SAVE_STATE,
nkeynes@1109
    45
    FILE_UNKNOWN,
nkeynes@1109
    46
} lxdream_file_type_t;
nkeynes@26
    47
nkeynes@26
    48
/**
nkeynes@1109
    49
 * Attempt to identify the given file as one of the above file types
nkeynes@26
    50
 */
nkeynes@1109
    51
lxdream_file_type_t file_identify( const gchar *filename, int fd, ERROR *err );
nkeynes@26
    52
nkeynes@26
    53
/**
nkeynes@1109
    54
 * Load any supported file, and return the type of file loaded.
nkeynes@1109
    55
 * If the file is a disc, the disc is mounted. 
nkeynes@1109
    56
 * 
nkeynes@1109
    57
 * @param filename The file to load
nkeynes@1109
    58
 * @param wrap_exec If true, load executables as disc images. Otherwise load 
nkeynes@1109
    59
 *    directly into RAM
nkeynes@1109
    60
 * @param err Updated with error message on failure.
nkeynes@26
    61
 */
nkeynes@1109
    62
lxdream_file_type_t file_load_magic( const gchar *filename, gboolean wrap_exec, ERROR *err );
nkeynes@26
    63
nkeynes@26
    64
/**
nkeynes@1109
    65
 * Load an ELF or .bin executable file based on magic.
nkeynes@26
    66
 */
nkeynes@1109
    67
gboolean file_load_exec( const gchar *filename, ERROR *err );
nkeynes@26
    68
nkeynes@1108
    69
cdrom_disc_t cdrom_wrap_magic( cdrom_disc_type_t type, const gchar *filename, ERROR *err );
nkeynes@1108
    70
nkeynes@26
    71
#ifdef __cplusplus
nkeynes@26
    72
}
nkeynes@26
    73
#endif
nkeynes@26
    74
nkeynes@736
    75
#endif /* !lxdream_loader_H */
nkeynes@26
    76
.