Search
lxdream.org :: lxdream/src/modules.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/modules.h
changeset 23:1ec3acd0594d
prev17:944f75eea496
next27:1ef09a52cd1e
author nkeynes
date Sat Dec 24 08:02:18 2005 +0000 (18 years ago)
permissions -rw-r--r--
last change More structure reorgs/fixes
view annotate diff log raw
     2 #ifndef dreamcast_modules_H
     3 #define dreamcast_modules_H 1
     5 #include <stdlib.h>
     6 #include <stdio.h>
     8 #ifdef __cplusplus
     9 extern "C" {
    10 #endif
    12 /**
    13  * Basic module structure defining the common operations across all
    14  * modules, ie start, stop, reset, etc. Nothing here is time-sensitive.
    15  */
    16 typedef struct dreamcast_module {
    17     char *name;
    18     /**
    19      * Perform all initial module setup (ie register / allocate any
    20      * memory required, etc). Only called once during DreamOn startup
    21      */
    22     void (*init)();
    23     /**
    24      * Reset the module into it's initial system boot state. Will be called
    25      * once after init(), as well as whenever the user requests a reset.
    26      */
    27     void (*reset)();
    28     /**
    29      * Set the module into a running state (may be NULL)
    30      */
    31     void (*start)();
    32     /**
    33      * Execute one time-slice worth of operations, for the given number of
    34      * micro-seconds.
    35      */
    36     void (*run_time_slice)( int microsecs );
    37     /**
    38      * Set the module into a stopped state (may be NULL)
    39      */
    40     void (*stop)();
    41     /**
    42      * Save the module state to the FILE stream. May be NULL, in which case
    43      * the module is considered to have no state.
    44      */
    45     void (*save)(FILE *);
    46     /**
    47      * Load the saved module state from the FILE stream. May be NULL, in which
    48      * case reset() will be called instead.
    49      * @return 0 on success, nonzero on failure.
    50      */
    51     int (*load)(FILE *);
    52 } *dreamcast_module_t;
    54 void dreamcast_register_module( dreamcast_module_t );
    56 extern struct dreamcast_module mem_module;
    57 extern struct dreamcast_module sh4_module;
    58 extern struct dreamcast_module asic_module;
    59 extern struct dreamcast_module pvr2_module;
    60 extern struct dreamcast_module aica_module;
    61 extern struct dreamcast_module ide_module;
    62 extern struct dreamcast_module maple_module;
    63 extern struct dreamcast_module pvr2_module;
    64 extern struct dreamcast_module gui_module;
    66 void fwrite_string( char *s, FILE *f );
    67 int fread_string( char *s, int maxlen, FILE *f );
    69 #ifdef __cplusplus
    70 }
    71 #endif
    73 #endif /* !dreamcast_modules_H */
.