1 |
|
/* |
2 |
|
* main_x.h - Main program, Unix specific stuff |
3 |
|
* |
4 |
< |
* Frodo (C) 1994-1997,2002 Christian Bauer |
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 |
20 |
|
|
21 |
|
#include "Version.h" |
22 |
|
|
23 |
+ |
#ifdef HAVE_GLADE |
24 |
+ |
#include <gnome.h> |
25 |
+ |
#endif |
26 |
+ |
|
27 |
+ |
// Qtopia Windowing System |
28 |
+ |
#ifdef QWS |
29 |
+ |
extern "C" int main(int argc, char *argv[]); |
30 |
+ |
#include <SDL.h> |
31 |
+ |
#endif |
32 |
|
|
33 |
|
extern int init_graphics(void); |
34 |
|
|
43 |
|
|
44 |
|
int main(int argc, char **argv) |
45 |
|
{ |
46 |
< |
Frodo *the_app; |
46 |
> |
#ifdef HAVE_GLADE |
47 |
> |
gnome_program_init(PACKAGE_NAME, PACKAGE_VERSION, LIBGNOMEUI_MODULE, argc, argv, |
48 |
> |
GNOME_PARAM_APP_DATADIR, DATADIR, NULL); |
49 |
> |
#endif |
50 |
|
|
51 |
|
timeval tv; |
52 |
|
gettimeofday(&tv, NULL); |
53 |
|
srand(tv.tv_usec); |
54 |
|
|
55 |
< |
printf("%s by Christian Bauer\n", VERSION_STRING); |
55 |
> |
#ifndef HAVE_GLADE |
56 |
> |
printf( |
57 |
> |
"%s Copyright (C) 1994-1997,2002-2004 Christian Bauer\n" |
58 |
> |
"This is free software with ABSOLUTELY NO WARRANTY.\n" |
59 |
> |
, VERSION_STRING |
60 |
> |
); |
61 |
> |
#endif |
62 |
|
if (!init_graphics()) |
63 |
< |
return 0; |
63 |
> |
return 1; |
64 |
|
fflush(stdout); |
65 |
|
|
66 |
< |
the_app = new Frodo(); |
66 |
> |
Frodo *the_app = new Frodo(); |
67 |
|
the_app->ArgvReceived(argc, argv); |
68 |
|
the_app->ReadyToRun(); |
69 |
|
delete the_app; |
112 |
|
} |
113 |
|
ThePrefs.Load(prefs_path); |
114 |
|
|
115 |
+ |
// Show preferences editor |
116 |
+ |
#ifdef HAVE_GLADE |
117 |
+ |
if (!ThePrefs.ShowEditor(true, prefs_path)) |
118 |
+ |
return; |
119 |
+ |
#endif |
120 |
+ |
|
121 |
|
// Create and start C64 |
122 |
|
TheC64 = new C64; |
123 |
< |
if (load_rom_files()) |
124 |
< |
TheC64->Run(); |
123 |
> |
load_rom_files(); |
124 |
> |
TheC64->Run(); |
125 |
|
delete TheC64; |
126 |
|
} |
127 |
|
|
132 |
|
newprefs.Load(prefs_path); |
133 |
|
return &newprefs; |
134 |
|
} |
135 |
+ |
|
136 |
+ |
|
137 |
+ |
/* |
138 |
+ |
* Determine whether path name refers to a directory |
139 |
+ |
*/ |
140 |
+ |
|
141 |
+ |
bool IsDirectory(const char *path) |
142 |
+ |
{ |
143 |
+ |
struct stat st; |
144 |
+ |
return stat(path, &st) == 0 && S_ISDIR(st.st_mode); |
145 |
+ |
} |