forked from freemint/cflib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp_init.c
More file actions
129 lines (114 loc) · 3.24 KB
/
Copy pathapp_init.c
File metadata and controls
129 lines (114 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
* CFLIB, a GEM library for ATARI/TOS
* Copyright (C) 1999, 2000 Christian Felsch
*
* Modified for FreeMiNT CVS by Frank Naumann <fnaumann@freemint.de>
*
* Please send suggestions, patches or bug reports to me or
* the MiNT mailing list.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifdef __MINT__
#include <osbind.h>
#endif
#include "intern.h"
#include "app.h"
void
init_app (char *rsc)
{
short d;
long l;
short work_out[57];
char s[128];
char path[256];
debug ("started\n");
gl_apid = appl_init ();
gl_phys_handle =
graf_handle (&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox);
wind_get_grect (0, WF_WORKXYWH, &gl_desk);
graf_mouse (ARROW, 0x0L);
__app_hidden = 0;
#if defined( __MINT__ ) || defined( _GEMLIB_H_ )
gl_gem = _AESversion;
#else
gl_gem = _GemParBlk.global[0];
#endif
if (getcookie ("MiNT", &l))
gl_mint = (int) l;
gl_magx = get_magx_version ();
cf_magxPC = getcookie ("MgPC", NULL);
if (getcookie ("nAES", &l))
gl_naes = *(unsigned short *) l;
if (getcookie ("NVDI", &l))
gl_nvdi = *(unsigned short *) l;
/*
* Ozk: Detect XaAES
*/
if (appl_getinfo_str(AES_VERSION, s, NULL, NULL, NULL))
{
s[8] = '\0';
gl_xaaes = (!strcmp(" XaAES", s)) ? 1 : 0;
}
/* Systemzeichenstze bestimmen */
if (appl_xgetinfo (0, &sys_big_height, &sys_big_id, &d, &d) == 0)
{
sys_big_id = 1;
if ((Getrez () == 0) || (Getrez () == 1)) /* ST-Low/Mid */
sys_big_height = 6;
else
sys_big_height = 13;
}
if (appl_xgetinfo (1, &sys_sml_height, &sys_sml_id, &d, &d) == 0)
{
sys_sml_id = 1;
sys_sml_height = 4;
}
cf_vdi_handle = open_vwork (work_out);
cf_font_anz = work_out[10];
vq_extnd (cf_vdi_handle, TRUE, work_out);
gl_planes = work_out[4];
/* Aus den Pixel-Hhen Point-Hhen ermitteln */
sys_sml_pts = height2pts (cf_vdi_handle, sys_sml_id, sys_sml_height);
sys_big_pts = height2pts (cf_vdi_handle, sys_big_id, sys_big_height);
gl_gdos = (vq_vgdos () != -2);
if (gl_gdos)
cf_font_anz += vst_load_fonts (cf_vdi_handle, 0);
vst_font (cf_vdi_handle, sys_big_id);
vst_point (cf_vdi_handle, sys_big_pts, &sys_wchar, &sys_hchar,
&sys_wbox, &sys_hbox);
/*
* Startverzeichnis ermitteln.
* Unter N.AES (Minix) kann es ungltige Pfade geben, daher der extra
* path_exitst().
*/
shel_read (path, s);
split_filename (path, gl_appdir, NULL);
if (!path_exists (gl_appdir))
get_path (gl_appdir, 0);
init_userdef ();
if (rsc && *rsc != '\0')
{
__app_rsc_load = (rsrc_load (rsc) != 0);
if (!__app_rsc_load)
{
form_alert (1,
"[3][RSC nicht gefunden!|RSC not found!][Exit]");
exit_app (-1);
}
}
}