1 |
/* |
2 |
* main.h - Main program |
3 |
* |
4 |
* Frodo (C) 1994-1997,2002-2004 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 |
private: |
75 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
76 |
void load_rom_files(); |
77 |
|
78 |
char prefs_path[1024]; // Pathname of current preferences file |
79 |
bool prefs_showing; // true: Preferences editor is on screen |
80 |
|
81 |
BMessenger this_messenger; |
82 |
BFilePanel *open_panel; |
83 |
BFilePanel *save_panel; |
84 |
}; |
85 |
|
86 |
#endif |
87 |
|
88 |
|
89 |
/* |
90 |
* AmigaOS specific stuff |
91 |
*/ |
92 |
|
93 |
#ifdef AMIGA |
94 |
|
95 |
class Frodo { |
96 |
public: |
97 |
Frodo(); |
98 |
void ArgvReceived(int argc, char **argv); |
99 |
void ReadyToRun(void); |
100 |
void RunPrefsEditor(void); |
101 |
|
102 |
private: |
103 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
104 |
void load_rom_files(); |
105 |
|
106 |
char prefs_path[256]; // Pathname of current preferences file |
107 |
}; |
108 |
|
109 |
// Global variables |
110 |
extern Frodo *be_app; // Pointer to Frodo object |
111 |
|
112 |
#endif |
113 |
|
114 |
|
115 |
/* |
116 |
* X specific stuff |
117 |
*/ |
118 |
|
119 |
#ifdef __unix |
120 |
|
121 |
class Prefs; |
122 |
|
123 |
class Frodo { |
124 |
public: |
125 |
Frodo(); |
126 |
void ArgvReceived(int argc, char **argv); |
127 |
void ReadyToRun(void); |
128 |
static Prefs *reload_prefs(void); |
129 |
|
130 |
private: |
131 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
132 |
void load_rom_files(); |
133 |
|
134 |
static char prefs_path[256]; // Pathname of current preferences file |
135 |
}; |
136 |
|
137 |
#endif |
138 |
|
139 |
|
140 |
/* |
141 |
* Mac specific stuff |
142 |
*/ |
143 |
|
144 |
#ifdef __mac__ |
145 |
|
146 |
class Frodo { |
147 |
public: |
148 |
Frodo(); |
149 |
|
150 |
void Run(void); |
151 |
|
152 |
private: |
153 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
154 |
void load_rom_files(); |
155 |
}; |
156 |
|
157 |
#endif |
158 |
|
159 |
|
160 |
/* |
161 |
* WIN32 specific stuff |
162 |
*/ |
163 |
|
164 |
#ifdef WIN32 |
165 |
|
166 |
class Frodo { |
167 |
public: |
168 |
Frodo(); |
169 |
~Frodo(); |
170 |
void ArgvReceived(int argc, char **argv); |
171 |
void ReadyToRun(); |
172 |
void RunPrefsEditor(); |
173 |
|
174 |
char prefs_path[256]; // Pathname of current preferences file |
175 |
|
176 |
private: |
177 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
178 |
void load_rom_files(); |
179 |
}; |
180 |
|
181 |
// Global variables |
182 |
extern Frodo *TheApp; // Pointer to Frodo object |
183 |
extern HINSTANCE hInstance; |
184 |
extern int nCmdShow; |
185 |
extern HWND hwnd; |
186 |
|
187 |
// Command line options. |
188 |
extern BOOL full_screen; |
189 |
|
190 |
#if defined(DEBUG) |
191 |
|
192 |
inline void Debug(const char *format, ...) |
193 |
{ |
194 |
va_list args; |
195 |
va_start(args, format); |
196 |
char tmp[256]; |
197 |
vsprintf(tmp, format, args); |
198 |
va_end(args); |
199 |
OutputDebugString(tmp); |
200 |
} |
201 |
|
202 |
#else |
203 |
|
204 |
inline void Debug(const char *format, ...) |
205 |
{ |
206 |
} |
207 |
|
208 |
#endif |
209 |
|
210 |
#define DebugResult(message, val) \ |
211 |
Debug("%s: 0x%x (%d)\n", message, val, HRESULT_CODE(val)) |
212 |
|
213 |
#endif |
214 |
|
215 |
|
216 |
/* |
217 |
* RiscOS specific stuff |
218 |
*/ |
219 |
|
220 |
#ifdef __riscos__ |
221 |
|
222 |
class Frodo |
223 |
{ |
224 |
public: |
225 |
Frodo(); |
226 |
~Frodo(); |
227 |
void ReadyToRun(void); |
228 |
|
229 |
private: |
230 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
231 |
void load_rom_files(); |
232 |
}; |
233 |
|
234 |
#endif |
235 |
|
236 |
// Global C64 object |
237 |
extern C64 *TheC64; |
238 |
|
239 |
|
240 |
#endif |