|
|
1.1 root 1: /*
1.1.1.5 root 2: Hatari - vdi.c
3:
4: This file is distributed under the GNU Public License, version 2 or at
5: your option any later version. Read the file gpl.txt for details.
1.1 root 6:
7: VDI (Virtual Device Interface) (Trap #2)
8:
1.1.1.5 root 9: To get higher resolutions on the Desktop, we intercept the VDI/Line-A calls
10: and set elements in their structures to the higher width/height/cel/planes.
11: We need to intercept the initial Line-A call (which we force into the TOS on
12: boot-up) and also the init calls to the VDI.
1.1 root 13: */
1.1.1.10! root 14: const char VDI_rcsid[] = "Hatari $Id: vdi.c,v 1.31 2008/05/03 18:58:22 thothy Exp $";
1.1 root 15:
16: #include "main.h"
17: #include "file.h"
18: #include "gemdos.h"
19: #include "m68000.h"
20: #include "screen.h"
21: #include "stMemory.h"
22: #include "vdi.h"
23: #include "video.h"
1.1.1.9 root 24: #include "configuration.h"
1.1 root 25:
26:
1.1.1.7 root 27: Uint32 VDI_OldPC; /* When call Trap#2, store off PC */
1.1.1.2 root 28:
1.1.1.10! root 29: bool bUseVDIRes = FALSE; /* Set to TRUE (if want VDI), or FALSE (ie for games) */
1.1.1.9 root 30: /* defaults */
31: int VDIRes = 0; /* 0,1 or 2 (low, medium, high) */
32: int VDIWidth = 640; /* 640x480, 800x600 or 1024x768 */
33: int VDIHeight = 480;
34: int VDIPlanes = 4;
35: static int VDIColors = 16;
36: static int VDICharHeight = 8;
37:
38: static Uint32 LineABase; /* Line-A structure */
39: static Uint32 FontBase; /* Font base, used for 16-pixel high font */
1.1 root 40:
1.1.1.8 root 41: static Uint32 Control;
42: static Uint32 Intin;
43: static Uint32 Ptsin;
44: static Uint32 Intout;
45: static Uint32 Ptsout;
1.1 root 46:
1.1.1.2 root 47:
48: /*-----------------------------------------------------------------------*/
49: /* Desktop TOS 1.04 and TOS 2.06 desktop configuration files */
1.1.1.8 root 50: static const Uint8 DesktopScript[504] =
1.1.1.3 root 51: {
1.1.1.9 root 52: 0x23,0x61,0x30,0x30,0x30,0x30,0x30,0x30,0x0D,0x0A,0x23,0x62,0x30,0x30,0x30,0x30,
53: 0x30,0x30,0x0D,0x0A,0x23,0x63,0x37,0x37,0x37,0x30,0x30,0x30,0x37,0x30,0x30,0x30,
54: 0x36,0x30,0x30,0x30,0x37,0x30,0x30,0x35,0x35,0x32,0x30,0x30,0x35,0x30,0x35,0x35,
55: 0x35,0x32,0x32,0x32,0x30,0x37,0x37,0x30,0x35,0x35,0x37,0x30,0x37,0x35,0x30,0x35,
56: 0x35,0x35,0x30,0x37,0x37,0x30,0x33,0x31,0x31,0x31,0x31,0x30,0x33,0x0D,0x0A,0x23,
57: 0x64,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
58: 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
59: 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0D,0x0A,
60: 0x23,0x45,0x20,0x31,0x38,0x20,0x31,0x31,0x20,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,
61: 0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x37,0x20,0x32,0x36,0x20,0x30,0x43,0x20,
62: 0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,
63: 0x32,0x20,0x30,0x42,0x20,0x32,0x36,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,
64: 0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x41,0x20,0x30,0x46,0x20,
65: 0x31,0x41,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,
66: 0x30,0x20,0x30,0x30,0x20,0x30,0x45,0x20,0x30,0x31,0x20,0x31,0x41,0x20,0x30,0x39,
67: 0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x4D,0x20,0x30,0x31,0x20,0x30,0x30,0x20,
68: 0x30,0x30,0x20,0x46,0x46,0x20,0x43,0x20,0x48,0x41,0x52,0x44,0x20,0x44,0x49,0x53,
69: 0x4B,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x4D,0x20,0x30,0x30,0x20,0x30,0x30,0x20,
70: 0x30,0x30,0x20,0x46,0x46,0x20,0x41,0x20,0x46,0x4C,0x4F,0x50,0x50,0x59,0x20,0x44,
71: 0x49,0x53,0x4B,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x4D,0x20,0x30,0x30,0x20,0x30,
72: 0x31,0x20,0x30,0x30,0x20,0x46,0x46,0x20,0x42,0x20,0x46,0x4C,0x4F,0x50,0x50,0x59,
73: 0x20,0x44,0x49,0x53,0x4B,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x54,0x20,0x30,0x30,
74: 0x20,0x30,0x33,0x20,0x30,0x32,0x20,0x46,0x46,0x20,0x20,0x20,0x54,0x52,0x41,0x53,
75: 0x48,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x46,0x20,0x46,0x46,0x20,0x30,0x34,0x20,
76: 0x20,0x20,0x40,0x20,0x2A,0x2E,0x2A,0x40,0x20,0x0D,0x0A,0x23,0x44,0x20,0x46,0x46,
77: 0x20,0x30,0x31,0x20,0x20,0x20,0x40,0x20,0x2A,0x2E,0x2A,0x40,0x20,0x0D,0x0A,0x23,
78: 0x47,0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x20,0x20,0x2A,0x2E,0x41,0x50,0x50,0x40,
79: 0x20,0x40,0x20,0x0D,0x0A,0x23,0x47,0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x20,0x20,
80: 0x2A,0x2E,0x50,0x52,0x47,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x50,0x20,0x30,0x33,
81: 0x20,0x46,0x46,0x20,0x20,0x20,0x2A,0x2E,0x54,0x54,0x50,0x40,0x20,0x40,0x20,0x0D,
82: 0x0A,0x23,0x46,0x20,0x30,0x33,0x20,0x30,0x34,0x20,0x20,0x20,0x2A,0x2E,0x54,0x4F,
83: 0x53,0x40,0x20,0x40,0x20,0x0D,0x0A,0x1A
1.1 root 84: };
85:
1.1.1.8 root 86: static const Uint8 NewDeskScript[786] =
1.1.1.3 root 87: {
1.1.1.9 root 88: 0x23,0x61,0x30,0x30,0x30,0x30,0x30,0x30,0x0D,0x0A,0x23,0x62,0x30,0x30,0x30,0x30,
89: 0x30,0x30,0x0D,0x0A,0x23,0x63,0x37,0x37,0x37,0x30,0x30,0x30,0x37,0x30,0x30,0x30,
90: 0x36,0x30,0x30,0x30,0x37,0x30,0x30,0x35,0x35,0x32,0x30,0x30,0x35,0x30,0x35,0x35,
91: 0x35,0x32,0x32,0x32,0x30,0x37,0x37,0x30,0x35,0x35,0x37,0x30,0x37,0x35,0x30,0x35,
92: 0x35,0x35,0x30,0x37,0x37,0x30,0x33,0x31,0x31,0x31,0x31,0x30,0x33,0x0D,0x0A,0x23,
93: 0x64,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
94: 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
95: 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0D,0x0A,
96: 0x23,0x4B,0x20,0x34,0x46,0x20,0x35,0x33,0x20,0x34,0x43,0x20,0x30,0x30,0x20,0x34,
97: 0x36,0x20,0x34,0x32,0x20,0x34,0x33,0x20,0x35,0x37,0x20,0x34,0x35,0x20,0x35,0x38,
98: 0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,
99: 0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,
100: 0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x35,0x32,0x20,0x30,0x30,0x20,0x30,0x30,
101: 0x20,0x34,0x44,0x20,0x35,0x36,0x20,0x35,0x30,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,
102: 0x23,0x45,0x20,0x31,0x38,0x20,0x30,0x31,0x20,0x30,0x30,0x20,0x30,0x36,0x20,0x0D,
103: 0x0A,0x23,0x51,0x20,0x34,0x31,0x20,0x34,0x30,0x20,0x34,0x33,0x20,0x34,0x30,0x20,
104: 0x34,0x33,0x20,0x34,0x30,0x20,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,
105: 0x20,0x30,0x30,0x20,0x30,0x37,0x20,0x32,0x36,0x20,0x30,0x43,0x20,0x30,0x30,0x20,
106: 0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x32,0x20,0x30,
107: 0x42,0x20,0x32,0x36,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,
108: 0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x41,0x20,0x30,0x46,0x20,0x31,0x41,0x20,
109: 0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,
110: 0x30,0x20,0x30,0x45,0x20,0x30,0x31,0x20,0x31,0x41,0x20,0x30,0x39,0x20,0x30,0x30,
111: 0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x34,0x20,
112: 0x30,0x37,0x20,0x32,0x36,0x20,0x30,0x43,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,
113: 0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x43,0x20,0x30,0x42,0x20,0x32,0x36,
114: 0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,
115: 0x30,0x30,0x20,0x30,0x38,0x20,0x30,0x46,0x20,0x31,0x41,0x20,0x30,0x39,0x20,0x30,
116: 0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x36,
117: 0x20,0x30,0x31,0x20,0x31,0x41,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,
118: 0x23,0x4E,0x20,0x46,0x46,0x20,0x30,0x34,0x20,0x30,0x30,0x30,0x20,0x40,0x20,0x2A,
119: 0x2E,0x2A,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x44,0x20,0x46,0x46,0x20,0x30,0x31,
120: 0x20,0x30,0x30,0x30,0x20,0x40,0x20,0x2A,0x2E,0x2A,0x40,0x20,0x40,0x20,0x0D,0x0A,
121: 0x23,0x47,0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x30,0x30,0x30,0x20,0x2A,0x2E,0x41,
122: 0x50,0x50,0x40,0x20,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x47,0x20,0x30,0x33,0x20,
123: 0x46,0x46,0x20,0x30,0x30,0x30,0x20,0x2A,0x2E,0x50,0x52,0x47,0x40,0x20,0x40,0x20,
124: 0x40,0x20,0x0D,0x0A,0x23,0x59,0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x30,0x30,0x30,
125: 0x20,0x2A,0x2E,0x47,0x54,0x50,0x40,0x20,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x50,
126: 0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x30,0x30,0x30,0x20,0x2A,0x2E,0x54,0x54,0x50,
127: 0x40,0x20,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x46,0x20,0x30,0x33,0x20,0x30,0x34,
128: 0x20,0x30,0x30,0x30,0x20,0x2A,0x2E,0x54,0x4F,0x53,0x40,0x20,0x40,0x20,0x40,0x20,
129: 0x0D,0x0A,0x23,0x4D,0x20,0x30,0x30,0x20,0x30,0x31,0x20,0x30,0x30,0x20,0x46,0x46,
130: 0x20,0x43,0x20,0x48,0x41,0x52,0x44,0x20,0x44,0x49,0x53,0x4B,0x40,0x20,0x40,0x20,
131: 0x0D,0x0A,0x23,0x4D,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x46,0x46,
132: 0x20,0x41,0x20,0x46,0x4C,0x4F,0x50,0x50,0x59,0x20,0x44,0x49,0x53,0x4B,0x40,0x20,
133: 0x40,0x20,0x0D,0x0A,0x23,0x4D,0x20,0x30,0x31,0x20,0x30,0x30,0x20,0x30,0x30,0x20,
134: 0x46,0x46,0x20,0x42,0x20,0x46,0x4C,0x4F,0x50,0x50,0x59,0x20,0x44,0x49,0x53,0x4B,
135: 0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x54,0x20,0x30,0x30,0x20,0x30,0x33,0x20,0x30,
136: 0x32,0x20,0x46,0x46,0x20,0x20,0x20,0x54,0x52,0x41,0x53,0x48,0x40,0x20,0x40,0x20,
137: 0x0D,0x0A
1.1 root 138: };
139:
1.1.1.2 root 140:
141: /*-----------------------------------------------------------------------*/
1.1.1.9 root 142: /**
143: * Returns given value after constraining it within "min" and "max" values
144: * and making it evenly divisable by "align"
145: */
146: int VDI_Limit(int value, int align, int min, int max)
1.1 root 147: {
1.1.1.9 root 148: value = (value/align)*align;
149: if (value > max)
150: {
151: /* align down */
152: return (max/align)*align;
153: }
154: if (value < min)
155: {
156: /* align up */
157: min += align-1;
158: return (min/align)*align;
159: }
160: return value;
1.1 root 161: }
162:
1.1.1.2 root 163:
164: /*-----------------------------------------------------------------------*/
1.1.1.9 root 165: /**
166: * Set Width/Height/BitDepth according to passed GEMRES_640x480,
167: * GEMRES_800x600, GEMRES_OTHER. Align size when necessary.
168: */
169: void VDI_SetResolution(int GEMColor, int WidthRequest, int HeightRequest)
170: {
171: /* Color depth */
172: switch (GEMColor)
173: {
174: case GEMCOLOR_2:
175: VDIRes = 2;
176: VDIPlanes = 1;
177: VDIColors = 2;
178: VDICharHeight = 16;
179: break;
180: case GEMCOLOR_4:
181: VDIRes = 1;
182: VDIPlanes = 2;
183: VDIColors = 4;
184: VDICharHeight = 8;
185: break;
186: case GEMCOLOR_16:
187: VDIRes = 0;
188: VDIPlanes = 4;
189: VDIColors = 16;
190: VDICharHeight = 8;
191: break;
192: }
193:
194: /* width needs to be aligned to 16 bytes */
195: VDIWidth = VDI_Limit(WidthRequest, 128/VDIPlanes, MIN_VDI_WIDTH, MAX_VDI_WIDTH);
196: /* height needs to be multiple of cell height */
197: VDIHeight = VDI_Limit(HeightRequest, VDICharHeight, MIN_VDI_HEIGHT, MAX_VDI_HEIGHT);
198: printf("VDI screen: request = %dx%d@%d, aligned result = %dx%d@%d\n",
199: WidthRequest, HeightRequest, VDIPlanes, VDIWidth, VDIHeight, VDIPlanes);
200:
201: /* Write resolution to re-boot takes effect with correct bit-depth */
202: VDI_FixDesktopInf();
203: }
204:
1.1 root 205:
1.1.1.9 root 206: /*-----------------------------------------------------------------------*/
207: /**
208: * Check VDI call and see if we need to re-direct to our own routines
209: * Return TRUE if we've handled the exception, else return FALSE
210: *
211: * We enter here with Trap #2, so D1 is pointer to VDI vectors, ie Control, Intin, Ptsin etc...
212: */
1.1.1.10! root 213: bool VDI(void)
1.1 root 214: {
1.1.1.9 root 215: Uint32 TablePtr = Regs[REG_D1];
216: /*unsigned short int OpCode;*/
1.1 root 217:
1.1.1.9 root 218: /* Read off table pointers */
219: Control = STMemory_ReadLong(TablePtr);
220: Intin = STMemory_ReadLong(TablePtr+4);
221: Ptsin = STMemory_ReadLong(TablePtr+8);
222: Intout = STMemory_ReadLong(TablePtr+12);
223: Ptsout = STMemory_ReadLong(TablePtr+16);
224:
225: /*
226: OpCode = STMemory_ReadWord(Control);
227: // Check OpCode
228: // 8 - Text Font
229: if (OpCode==9)
230: {
231: return TRUE;
232: }
233: */
1.1 root 234:
1.1.1.9 root 235: /* Call as normal! */
236: return FALSE;
1.1 root 237: }
238:
1.1.1.2 root 239:
240: /*-----------------------------------------------------------------------*/
1.1.1.9 root 241: /**
242: * Modify Line-A structure for our VDI resolutions
243: */
244: void VDI_LineA(Uint32 linea, Uint32 fontbase)
1.1 root 245: {
1.1.1.9 root 246: if (bUseVDIRes)
247: {
248: STMemory_WriteWord(linea-46, VDICharHeight); /* v_cel_ht */
249: STMemory_WriteWord(linea-44, (VDIWidth/8)-1); /* v_cel_mx (cols-1) */
250: STMemory_WriteWord(linea-42, (VDIHeight/VDICharHeight)-1); /* v_cel_my (rows-1) */
251: STMemory_WriteWord(linea-40, VDICharHeight*((VDIWidth*VDIPlanes)/8)); /* v_cel_wr */
252:
253: STMemory_WriteWord(linea-12, VDIWidth); /* v_rez_hz */
254: STMemory_WriteWord(linea-4, VDIHeight); /* v_rez_vt */
255: STMemory_WriteWord(linea-2, (VDIWidth*VDIPlanes)/8); /* bytes_lin */
256: STMemory_WriteWord(linea+0, VDIPlanes); /* planes */
257: STMemory_WriteWord(linea+2, (VDIWidth*VDIPlanes)/8); /* width */
258: }
259: LineABase = linea;
260: FontBase = fontbase;
1.1 root 261: }
262:
1.1.1.2 root 263:
264: /*-----------------------------------------------------------------------*/
1.1.1.9 root 265: /**
266: * This is called on completion of a VDI Trap, used to modify return structure for
267: */
1.1 root 268: void VDI_Complete(void)
269: {
1.1.1.10! root 270: Uint16 OpCode;
1.1 root 271:
1.1.1.9 root 272: OpCode = STMemory_ReadWord(Control);
273: /* Is 'Open Workstation', or 'Open Virtual Screen Workstation'? */
274: if ( (OpCode==1) || (OpCode==100) )
275: {
276: STMemory_WriteWord(Intout, VDIWidth-1); /* IntOut[0] Width-1 */
277: STMemory_WriteWord(Intout+1*2, VDIHeight-1); /* IntOut[1] Height-1 */
278: STMemory_WriteWord(Intout+13*2, VDIColors); /* IntOut[13] #colors */
279: STMemory_WriteWord(Intout+39*2, 512); /* IntOut[39] #available colors */
1.1 root 280:
1.1.1.9 root 281: STMemory_WriteWord(LineABase-0x15a*2, VDIWidth-1); /* WKXRez */
282: STMemory_WriteWord(LineABase-0x159*2, VDIHeight-1); /* WKYRez */
1.1 root 283:
1.1.1.9 root 284: VDI_LineA(LineABase, FontBase); /* And modify Line-A structure accordingly */
285: }
1.1.1.10! root 286: HATARI_TRACE ( HATARI_TRACE_OS_VDI, "VDI opcode %hd completed\n", OpCode );
1.1 root 287: }
288:
1.1.1.2 root 289:
290: /*-----------------------------------------------------------------------*/
1.1.1.9 root 291: /**
292: * Save desktop configuration file for VDI, eg desktop.inf(TOS 1.04) or newdesk.inf(TOS 2.06)
293: */
1.1.1.8 root 294: static void VDI_SaveDesktopInf(char *pszFileName, const Uint8 *Script, long ScriptSize)
1.1 root 295: {
1.1.1.9 root 296: /* Just save file */
297: File_Save(pszFileName, Script, ScriptSize, FALSE);
1.1 root 298: }
299:
1.1.1.2 root 300:
301: /*-----------------------------------------------------------------------*/
1.1.1.9 root 302: /**
303: * Modify exisiting ST desktop configuration files to set resolution(keep user settings)
304: */
1.1.1.5 root 305: static void VDI_ModifyDesktopInf(char *pszFileName)
1.1 root 306: {
1.1.1.9 root 307: long InfSize;
308: Uint8 *pInfData;
309: int i;
310:
311: /* Load our '.inf' file */
312: pInfData = File_Read(pszFileName, &InfSize, NULL);
313: if (pInfData)
314: {
315: /* Scan file for '#E' */
316: i = 0;
317: while (i < (InfSize-8))
318: {
319: if ((pInfData[i]=='#') && (pInfData[i+1]=='E'))
320: {
321: /* Modify resolution */
322: pInfData[i+7] = '1'+VDIRes;
323: break;
324: }
325:
326: i++;
327: }
328:
329: /* And save */
330: File_Save(pszFileName, pInfData, InfSize, FALSE);
331: /* Free */
332: free(pInfData);
333: }
1.1 root 334: }
335:
1.1.1.2 root 336:
337: /*-----------------------------------------------------------------------*/
1.1.1.9 root 338: /**
339: * Modify (or create) ST desktop configuration files so VDI boots up in
340: * correct color depth
341: */
1.1 root 342: void VDI_FixDesktopInf(void)
343: {
1.1.1.9 root 344: char *szDesktopFileName, *szNewDeskFileName;
1.1 root 345:
1.1.1.9 root 346: if (!GEMDOS_EMU_ON)
347: {
348: /* Can't modify DESKTOP.INF when not using GEMDOS hard disk emulation */
349: return;
350: }
351:
352: szDesktopFileName = malloc(2 * FILENAME_MAX);
353: if (!szDesktopFileName)
354: {
355: perror("VDI_FixDesktopInf");
356: return;
357: }
358: szNewDeskFileName = szDesktopFileName + FILENAME_MAX;
359:
360: /* Create filenames for hard-drive */
361: GemDOS_CreateHardDriveFileName(2, "\\DESKTOP.INF", szDesktopFileName, FILENAME_MAX);
362: GemDOS_CreateHardDriveFileName(2, "\\NEWDESK.INF", szNewDeskFileName, FILENAME_MAX);
363:
364: /* First, check if files exist(ie modify or replace) */
365: if (!File_Exists(szDesktopFileName))
366: VDI_SaveDesktopInf(szDesktopFileName,DesktopScript,sizeof(DesktopScript));
367: VDI_ModifyDesktopInf(szDesktopFileName);
368:
369: if (!File_Exists(szNewDeskFileName))
370: VDI_SaveDesktopInf(szNewDeskFileName,NewDeskScript,sizeof(NewDeskScript));
371: VDI_ModifyDesktopInf(szNewDeskFileName);
1.1.1.5 root 372:
1.1.1.9 root 373: free(szDesktopFileName);
1.1 root 374: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.