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