1 |
/* |
2 |
* main.h - Main program |
3 |
* |
4 |
* Frodo (C) 1994-1997,2002-2003 Christian Bauer |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
*/ |
20 |
|
21 |
#ifndef _MAIN_H |
22 |
#define _MAIN_H |
23 |
|
24 |
|
25 |
class C64; |
26 |
|
27 |
// Global variables |
28 |
extern char AppDirPath[1024]; // Path of application directory |
29 |
|
30 |
|
31 |
/* |
32 |
* BeOS specific stuff |
33 |
*/ |
34 |
|
35 |
#ifdef __BEOS__ |
36 |
#include <AppKit.h> |
37 |
#include <StorageKit.h> |
38 |
|
39 |
// Global variables |
40 |
extern bool FromShell; // true: Started from shell, SAM can be used |
41 |
extern BEntry AppDirectory; // Application directory |
42 |
|
43 |
|
44 |
// Message codes |
45 |
const uint32 MSG_STARTUP = 'strt'; // Start emulation |
46 |
const uint32 MSG_PREFS = 'pref'; // Show preferences editor |
47 |
const uint32 MSG_PREFS_DONE = 'pdon'; // Preferences editor closed |
48 |
const uint32 MSG_RESET = 'rset'; // Reset C64 |
49 |
const uint32 MSG_NMI = 'nmi '; // Raise NMI |
50 |
const uint32 MSG_SAM = 'sam '; // Invoke SAM |
51 |
const uint32 MSG_NEXTDISK = 'ndsk'; // Insert next disk in drive 8 |
52 |
const uint32 MSG_TOGGLE_1541 = '1541'; // Toggle processor-level 1541 emulation |
53 |
const uint32 MSG_OPEN_SNAPSHOT = 'opss'; // Open snapshot file |
54 |
const uint32 MSG_SAVE_SNAPSHOT = 'svss'; // Save snapshot file |
55 |
const uint32 MSG_OPEN_SNAPSHOT_RETURNED = 'opsr'; // Open snapshot file panel returned |
56 |
const uint32 MSG_SAVE_SNAPSHOT_RETURNED = 'svsr'; // Save snapshot file panel returned |
57 |
|
58 |
|
59 |
// Application signature |
60 |
const char APP_SIGNATURE[] = "application/x-vnd.cebix-Frodo"; |
61 |
|
62 |
|
63 |
// Application class |
64 |
class Frodo : public BApplication { |
65 |
public: |
66 |
Frodo(); |
67 |
virtual void ArgvReceived(int32 argc, char **argv); |
68 |
virtual void RefsReceived(BMessage *message); |
69 |
virtual void ReadyToRun(void); |
70 |
virtual void MessageReceived(BMessage *msg); |
71 |
virtual bool QuitRequested(void); |
72 |
virtual void AboutRequested(void); |
73 |
|
74 |
C64 *TheC64; |
75 |
|
76 |
private: |
77 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
78 |
void load_rom_files(); |
79 |
|
80 |
char prefs_path[1024]; // Pathname of current preferences file |
81 |
bool prefs_showing; // true: Preferences editor is on screen |
82 |
|
83 |
BMessenger this_messenger; |
84 |
BFilePanel *open_panel; |
85 |
BFilePanel *save_panel; |
86 |
}; |
87 |
|
88 |
#endif |
89 |
|
90 |
|
91 |
/* |
92 |
* AmigaOS specific stuff |
93 |
*/ |
94 |
|
95 |
#ifdef AMIGA |
96 |
|
97 |
class Frodo { |
98 |
public: |
99 |
Frodo(); |
100 |
void ArgvReceived(int argc, char **argv); |
101 |
void ReadyToRun(void); |
102 |
void RunPrefsEditor(void); |
103 |
|
104 |
C64 *TheC64; |
105 |
|
106 |
private: |
107 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
108 |
void load_rom_files(); |
109 |
|
110 |
char prefs_path[256]; // Pathname of current preferences file |
111 |
}; |
112 |
|
113 |
// Global variables |
114 |
extern Frodo *be_app; // Pointer to Frodo object |
115 |
|
116 |
#endif |
117 |
|
118 |
|
119 |
/* |
120 |
* X specific stuff |
121 |
*/ |
122 |
|
123 |
#ifdef __unix |
124 |
|
125 |
class Prefs; |
126 |
|
127 |
class Frodo { |
128 |
public: |
129 |
Frodo(); |
130 |
void ArgvReceived(int argc, char **argv); |
131 |
void ReadyToRun(void); |
132 |
static Prefs *reload_prefs(void); |
133 |
|
134 |
C64 *TheC64; |
135 |
|
136 |
private: |
137 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
138 |
void load_rom_files(); |
139 |
|
140 |
static char prefs_path[256]; // Pathname of current preferences file |
141 |
}; |
142 |
|
143 |
#endif |
144 |
|
145 |
|
146 |
/* |
147 |
* Mac specific stuff |
148 |
*/ |
149 |
|
150 |
#ifdef __mac__ |
151 |
|
152 |
class Frodo { |
153 |
public: |
154 |
Frodo(); |
155 |
|
156 |
void Run(void); |
157 |
C64 *TheC64; |
158 |
|
159 |
private: |
160 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
161 |
void load_rom_files(); |
162 |
}; |
163 |
|
164 |
#endif |
165 |
|
166 |
|
167 |
/* |
168 |
* WIN32 specific stuff |
169 |
*/ |
170 |
|
171 |
#ifdef WIN32 |
172 |
|
173 |
class Frodo { |
174 |
public: |
175 |
Frodo(); |
176 |
~Frodo(); |
177 |
void ArgvReceived(int argc, char **argv); |
178 |
void ReadyToRun(); |
179 |
void RunPrefsEditor(); |
180 |
|
181 |
C64 *TheC64; |
182 |
char prefs_path[256]; // Pathname of current preferences file |
183 |
|
184 |
private: |
185 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
186 |
void load_rom_files(); |
187 |
}; |
188 |
|
189 |
// Global variables |
190 |
extern Frodo *TheApp; // Pointer to Frodo object |
191 |
extern HINSTANCE hInstance; |
192 |
extern int nCmdShow; |
193 |
extern HWND hwnd; |
194 |
|
195 |
// Command line options. |
196 |
extern BOOL full_screen; |
197 |
|
198 |
#if defined(DEBUG) |
199 |
|
200 |
inline void Debug(const char *format, ...) |
201 |
{ |
202 |
va_list args; |
203 |
va_start(args, format); |
204 |
char tmp[256]; |
205 |
vsprintf(tmp, format, args); |
206 |
va_end(args); |
207 |
OutputDebugString(tmp); |
208 |
} |
209 |
|
210 |
#else |
211 |
|
212 |
inline void Debug(const char *format, ...) |
213 |
{ |
214 |
} |
215 |
|
216 |
#endif |
217 |
|
218 |
#define DebugResult(message, val) \ |
219 |
Debug("%s: 0x%x (%d)\n", message, val, HRESULT_CODE(val)) |
220 |
|
221 |
#endif |
222 |
|
223 |
|
224 |
/* |
225 |
* RiscOS specific stuff |
226 |
*/ |
227 |
|
228 |
#ifdef __riscos__ |
229 |
|
230 |
class Frodo |
231 |
{ |
232 |
public: |
233 |
Frodo(); |
234 |
~Frodo(); |
235 |
void ReadyToRun(void); |
236 |
|
237 |
C64 *TheC64; |
238 |
|
239 |
private: |
240 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
241 |
void load_rom_files(); |
242 |
}; |
243 |
|
244 |
#endif |
245 |
|
246 |
|
247 |
#endif |