Search
lxdream.org :: lxdream/src/dreamcast.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/dreamcast.h
changeset 1100:50e702af9373
prev1072:d82e04e6d497
author nkeynes
date Mon Feb 15 17:27:14 2010 +1000 (12 years ago)
permissions -rw-r--r--
last change Hook up the fake bios boot
Use fakebios if invoked with -b, or if there's no boot rom loaded
file annotate diff log raw
nkeynes@26
     1
/**
nkeynes@586
     2
 * $Id$
nkeynes@26
     3
 *
nkeynes@26
     4
 * Public interface for dreamcast.c -
nkeynes@26
     5
 * Central switchboard for the system. This pulls all the individual modules
nkeynes@26
     6
 * together into some kind of coherent structure. This is also where you'd
nkeynes@26
     7
 * add Naomi support, if I ever get a board to play with...
nkeynes@26
     8
 *
nkeynes@26
     9
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@26
    10
 *
nkeynes@26
    11
 * This program is free software; you can redistribute it and/or modify
nkeynes@26
    12
 * it under the terms of the GNU General Public License as published by
nkeynes@26
    13
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@26
    14
 * (at your option) any later version.
nkeynes@26
    15
 *
nkeynes@26
    16
 * This program is distributed in the hope that it will be useful,
nkeynes@26
    17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@26
    18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@26
    19
 * GNU General Public License for more details.
nkeynes@26
    20
 */
nkeynes@2
    21
nkeynes@736
    22
#ifndef lxdream_dreamcast_H
nkeynes@736
    23
#define lxdream_dreamcast_H 1
nkeynes@2
    24
nkeynes@15
    25
#include <stdio.h>
nkeynes@477
    26
#include "lxdream.h"
nkeynes@15
    27
nkeynes@15
    28
#ifdef __cplusplus
nkeynes@15
    29
extern "C" {
nkeynes@15
    30
#endif
nkeynes@15
    31
nkeynes@30
    32
#define DEFAULT_TIMESLICE_LENGTH 1000000 /* nanoseconds */
nkeynes@359
    33
nkeynes@922
    34
#define XLAT_NEW_CACHE_SIZE 40 MB
nkeynes@359
    35
#define XLAT_TEMP_CACHE_SIZE 2 MB
nkeynes@359
    36
#define XLAT_OLD_CACHE_SIZE 8 MB
nkeynes@359
    37
nkeynes@1072
    38
struct lxdream_config_group; // Forward declaration
nkeynes@1072
    39
nkeynes@1100
    40
void dreamcast_configure(gboolean use_bootrom);
nkeynes@422
    41
void dreamcast_configure_aica_only(void);
nkeynes@1100
    42
void dreamcast_init(gboolean use_bootrom);
nkeynes@2
    43
void dreamcast_reset(void);
nkeynes@23
    44
void dreamcast_run(void);
nkeynes@689
    45
void dreamcast_set_run_time( unsigned int seconds, unsigned int nanosecs );
nkeynes@689
    46
void dreamcast_set_exit_on_stop( gboolean flag );
nkeynes@2
    47
void dreamcast_stop(void);
nkeynes@429
    48
void dreamcast_shutdown(void);
nkeynes@431
    49
gboolean dreamcast_is_running(void);
nkeynes@1072
    50
gboolean dreamcast_config_changed(void *data, struct lxdream_config_group *group, unsigned item,
nkeynes@1072
    51
                                       const gchar *oldval, const gchar *newval);
nkeynes@543
    52
/**
nkeynes@543
    53
 * Return if it's possible to start the VM - currently this requires 
nkeynes@543
    54
 * a) A configured system
nkeynes@543
    55
 * b) Some code to run (either a user program or a ROM)
nkeynes@543
    56
 */
nkeynes@543
    57
gboolean dreamcast_can_run(void);
nkeynes@543
    58
nkeynes@544
    59
/**
nkeynes@544
    60
 * Notify the VM that a program (ELF or other binary) has been loaded.
nkeynes@544
    61
 * 
nkeynes@544
    62
 */
nkeynes@544
    63
void dreamcast_program_loaded( const gchar *name, sh4addr_t entry_point );
nkeynes@544
    64
nkeynes@295
    65
#define DREAMCAST_SAVE_MAGIC "%!-lxDream!Save\0"
nkeynes@931
    66
#define DREAMCAST_SAVE_VERSION 0x00010006
nkeynes@295
    67
nkeynes@18
    68
int dreamcast_save_state( const gchar *filename );
nkeynes@18
    69
int dreamcast_load_state( const gchar *filename );
nkeynes@18
    70
nkeynes@1038
    71
/* Quick saves */
nkeynes@1038
    72
#define MAX_QUICK_STATE 9
nkeynes@1040
    73
#define QUICK_STATE_FILENAME "%s/quicksave%d.dst"
nkeynes@1038
    74
nkeynes@1038
    75
void dreamcast_quick_save();
nkeynes@1038
    76
void dreamcast_quick_load();
nkeynes@1038
    77
unsigned int dreamcast_get_quick_state();
nkeynes@1038
    78
void dreamcast_set_quick_state( unsigned int state );
nkeynes@1038
    79
gboolean dreamcast_has_quick_state( unsigned int state );
nkeynes@1038
    80
nkeynes@477
    81
/**
nkeynes@477
    82
 * Load the front-buffer image from the specified file.
nkeynes@477
    83
 * If the file is not a valid save state, returns NULL. Otherwise,
nkeynes@477
    84
 * returns a newly allocated frame_buffer that should be freed
nkeynes@477
    85
 * by the caller. (The data buffer is contained within the
nkeynes@477
    86
 * allocation and does not need to be freed separately)
nkeynes@477
    87
 */
nkeynes@477
    88
frame_buffer_t dreamcast_load_preview( const gchar *filename );
nkeynes@1100
    89
gboolean dreamcast_load_fakebios();
nkeynes@477
    90
nkeynes@295
    91
#define SCENE_SAVE_MAGIC "%!-lxDream!Scene"
nkeynes@295
    92
#define SCENE_SAVE_VERSION 0x00010000
nkeynes@295
    93
nkeynes@934
    94
extern unsigned char dc_main_ram[];
nkeynes@934
    95
extern unsigned char dc_boot_rom[];
nkeynes@934
    96
extern unsigned char dc_flash_ram[];
nkeynes@934
    97
nkeynes@15
    98
#ifdef __cplusplus
nkeynes@15
    99
}
nkeynes@15
   100
#endif
nkeynes@15
   101
nkeynes@736
   102
#endif /* !lxdream_dreamcast_H */
.