1 |
/* |
2 |
* main.h - Main program |
3 |
* |
4 |
* Frodo Copyright (C) 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(); |
128 |
bool RunPrefsEditor(); |
129 |
|
130 |
static const char *get_prefs_path() { return prefs_path; } |
131 |
|
132 |
private: |
133 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
134 |
void load_rom_files(); |
135 |
|
136 |
static char prefs_path[256]; // Pathname of current preferences file |
137 |
}; |
138 |
|
139 |
extern Frodo *TheApp; // Pointer to Frodo object |
140 |
|
141 |
#endif |
142 |
|
143 |
|
144 |
/* |
145 |
* Mac specific stuff |
146 |
*/ |
147 |
|
148 |
#ifdef __mac__ |
149 |
|
150 |
class Frodo { |
151 |
public: |
152 |
Frodo(); |
153 |
|
154 |
void Run(void); |
155 |
|
156 |
private: |
157 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
158 |
void load_rom_files(); |
159 |
}; |
160 |
|
161 |
#endif |
162 |
|
163 |
|
164 |
/* |
165 |
* WIN32 specific stuff |
166 |
*/ |
167 |
|
168 |
#ifdef WIN32 |
169 |
|
170 |
class Frodo { |
171 |
public: |
172 |
Frodo(); |
173 |
~Frodo(); |
174 |
void ArgvReceived(int argc, char **argv); |
175 |
void ReadyToRun(); |
176 |
void RunPrefsEditor(); |
177 |
|
178 |
char prefs_path[256]; // Pathname of current preferences file |
179 |
|
180 |
private: |
181 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
182 |
void load_rom_files(); |
183 |
}; |
184 |
|
185 |
// Global variables |
186 |
extern Frodo *TheApp; // Pointer to Frodo object |
187 |
extern HINSTANCE hInstance; |
188 |
extern int nCmdShow; |
189 |
extern HWND hwnd; |
190 |
|
191 |
// Command line options. |
192 |
extern BOOL full_screen; |
193 |
|
194 |
#endif |
195 |
|
196 |
|
197 |
/* |
198 |
* RiscOS specific stuff |
199 |
*/ |
200 |
|
201 |
#ifdef __riscos__ |
202 |
|
203 |
class Frodo |
204 |
{ |
205 |
public: |
206 |
Frodo(); |
207 |
~Frodo(); |
208 |
void ReadyToRun(void); |
209 |
|
210 |
private: |
211 |
void load_rom(const char *which, const char *path, uint8 *where, size_t size, const uint8 *builtin); |
212 |
void load_rom_files(); |
213 |
}; |
214 |
|
215 |
#endif |
216 |
|
217 |
// Global C64 object |
218 |
extern C64 *TheC64; |
219 |
|
220 |
|
221 |
/* |
222 |
* Functions |
223 |
*/ |
224 |
|
225 |
// Determine whether path name refers to a directory |
226 |
extern bool IsDirectory(const char *path); |
227 |
|
228 |
#endif |