filename | src/dream.h |
changeset | 736:a02d1475ccfd |
prev | 561:533f6b478071 |
next | 1041:5fcc39857c5c |
author | nkeynes |
date | Mon Jan 26 07:26:24 2009 +0000 (15 years ago) |
permissions | -rw-r--r-- |
last change | Add read_byte_for_write mem function for correct implementation of AND.B and friends with TLB enabled. Add read_byte and read_long MMIO stubs to do correct sign extension of IO reads |
view | annotate | diff | log | raw |
1 /**
2 * $Id$
3 *
4 * Miscellaneous application-wide declarations (mainly logging atm)
5 *
6 * Copyright (c) 2005 Nathan Keynes.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
19 #ifndef lxdream_dream_H
20 #define lxdream_dream_H 1
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <stdint.h>
25 #include <string.h>
26 #include "lxdream.h"
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 /************************ Modules ********************************/
33 /**
34 * Basic module structure defining the common operations across all
35 * modules, ie start, stop, reset, etc.
36 */
37 typedef struct dreamcast_module {
38 char *name;
39 /**
40 * Perform all initial module setup (ie register / allocate any
41 * memory required, etc). Only called once during system startup
42 */
43 void (*init)();
44 /**
45 * Reset the module into it's initial system boot state. Will be called
46 * once after init(), as well as whenever the user requests a reset.
47 */
48 void (*reset)();
49 /**
50 * Set the module into a running state (may be NULL)
51 */
52 void (*start)();
53 /**
54 * Execute one time-slice worth of operations, for the given number of
55 * nanoseconds.
56 * @return Number of nanoseconds actually executed
57 */
58 uint32_t (*run_time_slice)( uint32_t nanosecs );
59 /**
60 * Set the module into a stopped state (may be NULL)
61 */
62 void (*stop)();
63 /**
64 * Save the module state to the FILE stream. May be NULL, in which case
65 * the module is considered to have no state.
66 */
67 void (*save)(FILE *);
68 /**
69 * Load the saved module state from the FILE stream. May be NULL, in which
70 * case reset() will be called instead.
71 * @return 0 on success, nonzero on failure.
72 */
73 int (*load)(FILE *);
74 } *dreamcast_module_t;
76 void dreamcast_register_module( dreamcast_module_t );
78 extern struct dreamcast_module mem_module;
79 extern struct dreamcast_module sh4_module;
80 extern struct dreamcast_module asic_module;
81 extern struct dreamcast_module pvr2_module;
82 extern struct dreamcast_module aica_module;
83 extern struct dreamcast_module ide_module;
84 extern struct dreamcast_module maple_module;
85 extern struct dreamcast_module pvr2_module;
86 extern struct dreamcast_module gui_module;
87 extern struct dreamcast_module eventq_module;
88 extern struct dreamcast_module unknown_module;
90 void fwrite_string( const char *s, FILE *f );
91 int fread_string( char *s, int maxlen, FILE *f );
92 void fwrite_gzip( void *p, size_t size, size_t num, FILE *f );
93 int fread_gzip( void *p, size_t size, size_t num, FILE *f );
94 void fwrite_dump( unsigned char *buf, unsigned int length, FILE *f );
95 void fwrite_dump32( unsigned int *buf, unsigned int length, FILE *f );
96 void fwrite_dump32v( unsigned int *buf, unsigned int length, int wordsPerLine, FILE *f );
98 void install_crash_handler(void);
100 gboolean write_png_to_stream( FILE *f, frame_buffer_t );
101 frame_buffer_t read_png_from_stream( FILE *f );
103 #ifdef __cplusplus
104 }
105 #endif
106 #endif /* !lxdream_dream_H */
.