Annotation of hatari/src/vdi.c, revision 1.1.1.5

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.5 ! root       14: char VDI_rcsid[] = "Hatari $Id: vdi.c,v 1.11 2004/04/23 15:33:59 thothy Exp $";
1.1       root       15: 
                     16: #include "main.h"
                     17: #include "file.h"
                     18: #include "gemdos.h"
                     19: #include "m68000.h"
                     20: #include "memAlloc.h"
                     21: #include "screen.h"
                     22: #include "stMemory.h"
                     23: #include "vdi.h"
                     24: #include "video.h"
1.1.1.3   root       25: #include "uae-cpu/newcpu.h"
1.1       root       26: 
                     27: 
1.1.1.2   root       28: BOOL bUseVDIRes=FALSE;             /* Set to TRUE (if want VDI), or FALSE (ie for games) */
                     29: int LineABase;                     /* Line-A structure */
                     30: int FontBase;                      /* Font base, used for 16-pixel high font */
                     31: unsigned int VDI_OldPC;            /* When call Trap#2, store off PC */
                     32: 
                     33: int VDIWidth=640,VDIHeight=480;    /* 640x480,800x600 or 1024x768 */
                     34: int VDIRes=0;                      /* 0,1 or 2(low, medium, high) */
                     35: int VDIPlanes=4,VDIColours=16,VDICharHeight=8;  /* To match VDIRes */
1.1       root       36: 
                     37: unsigned long Control;
                     38: unsigned long Intin;
                     39: unsigned long Ptsin;
                     40: unsigned long Intout;
                     41: unsigned long Ptsout;
                     42: 
1.1.1.2   root       43: 
                     44: /*-----------------------------------------------------------------------*/
                     45: /* Desktop TOS 1.04 and TOS 2.06 desktop configuration files */
1.1.1.3   root       46: unsigned char DesktopScript[504] =
                     47: {
1.1       root       48: 0x23,0x61,0x30,0x30,0x30,0x30,0x30,0x30,0x0D,0x0A,0x23,0x62,0x30,0x30,0x30,0x30,0x30,0x30,0x0D,0x0A,0x23,0x63,0x37,0x37,0x37,0x30,0x30,0x30,0x37,0x30,0x30,0x30,
                     49: 0x36,0x30,0x30,0x30,0x37,0x30,0x30,0x35,0x35,0x32,0x30,0x30,0x35,0x30,0x35,0x35,0x35,0x32,0x32,0x32,0x30,0x37,0x37,0x30,0x35,0x35,0x37,0x30,0x37,0x35,0x30,0x35,
                     50: 0x35,0x35,0x30,0x37,0x37,0x30,0x33,0x31,0x31,0x31,0x31,0x30,0x33,0x0D,0x0A,0x23,0x64,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
                     51: 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0D,0x0A,
                     52: 0x23,0x45,0x20,0x31,0x38,0x20,0x31,0x31,0x20,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x37,0x20,0x32,0x36,0x20,0x30,0x43,0x20,
                     53: 0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x32,0x20,0x30,0x42,0x20,0x32,0x36,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,
                     54: 0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x41,0x20,0x30,0x46,0x20,0x31,0x41,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,
                     55: 0x30,0x20,0x30,0x30,0x20,0x30,0x45,0x20,0x30,0x31,0x20,0x31,0x41,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x4D,0x20,0x30,0x31,0x20,0x30,0x30,0x20,
                     56: 0x30,0x30,0x20,0x46,0x46,0x20,0x43,0x20,0x48,0x41,0x52,0x44,0x20,0x44,0x49,0x53,0x4B,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x4D,0x20,0x30,0x30,0x20,0x30,0x30,0x20,
                     57: 0x30,0x30,0x20,0x46,0x46,0x20,0x41,0x20,0x46,0x4C,0x4F,0x50,0x50,0x59,0x20,0x44,0x49,0x53,0x4B,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x4D,0x20,0x30,0x30,0x20,0x30,
                     58: 0x31,0x20,0x30,0x30,0x20,0x46,0x46,0x20,0x42,0x20,0x46,0x4C,0x4F,0x50,0x50,0x59,0x20,0x44,0x49,0x53,0x4B,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x54,0x20,0x30,0x30,
                     59: 0x20,0x30,0x33,0x20,0x30,0x32,0x20,0x46,0x46,0x20,0x20,0x20,0x54,0x52,0x41,0x53,0x48,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x46,0x20,0x46,0x46,0x20,0x30,0x34,0x20,
                     60: 0x20,0x20,0x40,0x20,0x2A,0x2E,0x2A,0x40,0x20,0x0D,0x0A,0x23,0x44,0x20,0x46,0x46,0x20,0x30,0x31,0x20,0x20,0x20,0x40,0x20,0x2A,0x2E,0x2A,0x40,0x20,0x0D,0x0A,0x23,
                     61: 0x47,0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x20,0x20,0x2A,0x2E,0x41,0x50,0x50,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x47,0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x20,0x20,
                     62: 0x2A,0x2E,0x50,0x52,0x47,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x50,0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x20,0x20,0x2A,0x2E,0x54,0x54,0x50,0x40,0x20,0x40,0x20,0x0D,
                     63: 0x0A,0x23,0x46,0x20,0x30,0x33,0x20,0x30,0x34,0x20,0x20,0x20,0x2A,0x2E,0x54,0x4F,0x53,0x40,0x20,0x40,0x20,0x0D,0x0A,0x1A,
                     64: };
                     65: 
1.1.1.3   root       66: unsigned char NewDeskScript[786] =
                     67: {
1.1       root       68: 0x23,0x61,0x30,0x30,0x30,0x30,0x30,0x30,0x0D,0x0A,0x23,0x62,0x30,0x30,0x30,0x30,0x30,0x30,0x0D,0x0A,0x23,0x63,0x37,0x37,0x37,0x30,0x30,0x30,0x37,0x30,0x30,0x30,
                     69: 0x36,0x30,0x30,0x30,0x37,0x30,0x30,0x35,0x35,0x32,0x30,0x30,0x35,0x30,0x35,0x35,0x35,0x32,0x32,0x32,0x30,0x37,0x37,0x30,0x35,0x35,0x37,0x30,0x37,0x35,0x30,0x35,
                     70: 0x35,0x35,0x30,0x37,0x37,0x30,0x33,0x31,0x31,0x31,0x31,0x30,0x33,0x0D,0x0A,0x23,0x64,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
                     71: 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0D,0x0A,
                     72: 0x23,0x4B,0x20,0x34,0x46,0x20,0x35,0x33,0x20,0x34,0x43,0x20,0x30,0x30,0x20,0x34,0x36,0x20,0x34,0x32,0x20,0x34,0x33,0x20,0x35,0x37,0x20,0x34,0x35,0x20,0x35,0x38,
                     73: 0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,
                     74: 0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x35,0x32,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x34,0x44,0x20,0x35,0x36,0x20,0x35,0x30,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,
                     75: 0x23,0x45,0x20,0x31,0x38,0x20,0x30,0x31,0x20,0x30,0x30,0x20,0x30,0x36,0x20,0x0D,0x0A,0x23,0x51,0x20,0x34,0x31,0x20,0x34,0x30,0x20,0x34,0x33,0x20,0x34,0x30,0x20,
                     76: 0x34,0x33,0x20,0x34,0x30,0x20,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x37,0x20,0x32,0x36,0x20,0x30,0x43,0x20,0x30,0x30,0x20,
                     77: 0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x32,0x20,0x30,0x42,0x20,0x32,0x36,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,
                     78: 0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x41,0x20,0x30,0x46,0x20,0x31,0x41,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,
                     79: 0x30,0x20,0x30,0x45,0x20,0x30,0x31,0x20,0x31,0x41,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x34,0x20,
                     80: 0x30,0x37,0x20,0x32,0x36,0x20,0x30,0x43,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x43,0x20,0x30,0x42,0x20,0x32,0x36,
                     81: 0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x38,0x20,0x30,0x46,0x20,0x31,0x41,0x20,0x30,0x39,0x20,0x30,
                     82: 0x30,0x20,0x40,0x0D,0x0A,0x23,0x57,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x36,0x20,0x30,0x31,0x20,0x31,0x41,0x20,0x30,0x39,0x20,0x30,0x30,0x20,0x40,0x0D,0x0A,
                     83: 0x23,0x4E,0x20,0x46,0x46,0x20,0x30,0x34,0x20,0x30,0x30,0x30,0x20,0x40,0x20,0x2A,0x2E,0x2A,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x44,0x20,0x46,0x46,0x20,0x30,0x31,
                     84: 0x20,0x30,0x30,0x30,0x20,0x40,0x20,0x2A,0x2E,0x2A,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x47,0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x30,0x30,0x30,0x20,0x2A,0x2E,0x41,
                     85: 0x50,0x50,0x40,0x20,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x47,0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x30,0x30,0x30,0x20,0x2A,0x2E,0x50,0x52,0x47,0x40,0x20,0x40,0x20,
                     86: 0x40,0x20,0x0D,0x0A,0x23,0x59,0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x30,0x30,0x30,0x20,0x2A,0x2E,0x47,0x54,0x50,0x40,0x20,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x50,
                     87: 0x20,0x30,0x33,0x20,0x46,0x46,0x20,0x30,0x30,0x30,0x20,0x2A,0x2E,0x54,0x54,0x50,0x40,0x20,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x46,0x20,0x30,0x33,0x20,0x30,0x34,
                     88: 0x20,0x30,0x30,0x30,0x20,0x2A,0x2E,0x54,0x4F,0x53,0x40,0x20,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x4D,0x20,0x30,0x30,0x20,0x30,0x31,0x20,0x30,0x30,0x20,0x46,0x46,
                     89: 0x20,0x43,0x20,0x48,0x41,0x52,0x44,0x20,0x44,0x49,0x53,0x4B,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x4D,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x30,0x30,0x20,0x46,0x46,
                     90: 0x20,0x41,0x20,0x46,0x4C,0x4F,0x50,0x50,0x59,0x20,0x44,0x49,0x53,0x4B,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x4D,0x20,0x30,0x31,0x20,0x30,0x30,0x20,0x30,0x30,0x20,
                     91: 0x46,0x46,0x20,0x42,0x20,0x46,0x4C,0x4F,0x50,0x50,0x59,0x20,0x44,0x49,0x53,0x4B,0x40,0x20,0x40,0x20,0x0D,0x0A,0x23,0x54,0x20,0x30,0x30,0x20,0x30,0x33,0x20,0x30,
                     92: 0x32,0x20,0x46,0x46,0x20,0x20,0x20,0x54,0x52,0x41,0x53,0x48,0x40,0x20,0x40,0x20,0x0D,0x0A,
                     93: };
                     94: 
1.1.1.2   root       95: 
                     96: /*-----------------------------------------------------------------------*/
1.1       root       97: /*
                     98:   Set Width/Height/BitDepth according to passed GEMRES_640x480, GEMRES_800x600 or GEMRES_1024x768
                     99: */
                    100: void VDI_SetResolution(int GEMRes,int GEMColour)
                    101: {
1.1.1.2   root      102:   /* Resolution */
1.1.1.3   root      103:   switch(GEMRes)
                    104:   {
1.1       root      105:     case GEMRES_640x480:
                    106:       VDIWidth = 640;
                    107:       VDIHeight = 480;
                    108:       break;
                    109:     case GEMRES_800x600:
                    110:       VDIWidth = 800;
                    111:       VDIHeight = 600;
                    112:       break;
                    113:     case GEMRES_1024x768:
                    114:       VDIWidth = 1024;
                    115:       VDIHeight = 768;
                    116:       break;
                    117:   }
                    118: 
1.1.1.2   root      119:   /* Colour depth */
1.1.1.3   root      120:   switch(GEMColour)
                    121:   {
1.1       root      122:     case GEMCOLOUR_2:
                    123:       VDIRes = 2;
                    124:       VDIPlanes = 1;
                    125:       VDIColours = 2;
                    126:       VDICharHeight = 16;
                    127:       break;
                    128:     case GEMCOLOUR_4:
                    129:       VDIRes = 1;
                    130:       VDIPlanes = 2;
                    131:       VDIColours = 4;
                    132:       VDICharHeight = 8;
                    133:       break;
                    134:     case GEMCOLOUR_16:
                    135:       VDIRes = 0;
                    136:       VDIPlanes = 4;
                    137:       VDIColours = 16;
                    138:       VDICharHeight = 8;
                    139:       break;
                    140:   }
                    141: 
1.1.1.2   root      142:   /* Force screen code to re-set bitmap/full-screen */
1.1       root      143:   Screen_SetDrawModes();
1.1.1.3   root      144:   /*Screen_SetupRGBTable();*/
1.1       root      145:   Screen_SetFullUpdate();
                    146:   PrevSTRes = -1;
                    147: 
1.1.1.2   root      148:   /* Write resolution to re-boot takes effect with correct bit-depth */
1.1       root      149:   VDI_FixDesktopInf();
                    150: }
                    151: 
1.1.1.2   root      152: 
                    153: /*-----------------------------------------------------------------------*/
1.1       root      154: /*
                    155:   Check VDI call and see if we need to re-direct to our own routines
                    156:   Return TRUE if we've handled the exception, else return FALSE
                    157: 
                    158:   We enter here with Trap #2, so D1 is pointer to VDI vectors, ie Control, Intin, Ptsin etc...
                    159: */
                    160: BOOL VDI(void)
                    161: {
                    162:   unsigned long TablePtr = Regs[REG_D1];
1.1.1.3   root      163:   /*unsigned short int OpCode;*/
1.1       root      164: 
1.1.1.2   root      165:   /* Read off table pointers */
1.1       root      166:   Control = STMemory_ReadLong(TablePtr);
                    167:   Intin = STMemory_ReadLong(TablePtr+4);
                    168:   Ptsin = STMemory_ReadLong(TablePtr+8);
                    169:   Intout = STMemory_ReadLong(TablePtr+12);
                    170:   Ptsout = STMemory_ReadLong(TablePtr+16);
                    171: 
1.1.1.3   root      172: /*
                    173:   OpCode = STMemory_ReadWord(Control);
1.1       root      174:   // Check OpCode
                    175:   // 8 - Text Font
1.1.1.3   root      176:   if (OpCode==9)
                    177:   {
                    178:     return(TRUE);
                    179:   }
                    180: */
1.1       root      181: 
1.1.1.2   root      182:   /* Call as normal! */
1.1       root      183:   return(FALSE);
                    184: }
                    185: 
1.1.1.2   root      186: 
                    187: /*-----------------------------------------------------------------------*/
1.1       root      188: /*
                    189:   Modify Line-A structure for our VDI resolutions
                    190: */
                    191: void VDI_LineA(void)
                    192: {
1.1.1.3   root      193:   if (bUseVDIRes)
                    194:   {
1.1.1.2   root      195:     STMemory_WriteWord(LineABase-6*2,VDIWidth);                      /* v_rez_hz */
                    196:     STMemory_WriteWord(LineABase-2*2,VDIHeight);                     /* v_rez_vt */
                    197:     STMemory_WriteWord(LineABase-1*2,(VDIWidth*VDIPlanes)/8);        /* bytes_lin */
                    198:     STMemory_WriteWord(LineABase+1*2,(VDIWidth*VDIPlanes)/8);        /* width */
                    199: 
                    200:     STMemory_WriteWord(LineABase-23*2,VDICharHeight);                /* char height */
                    201:     STMemory_WriteWord(LineABase-22*2,(VDIWidth/8)-1);               /* v_cel_mx */
                    202:     STMemory_WriteWord(LineABase-21*2,(VDIHeight/VDICharHeight)-1);  /* v_cel_my */
                    203:     STMemory_WriteWord(LineABase-20*2,VDICharHeight*((VDIWidth*VDIPlanes)/8));  /* v_cel_wr */
1.1       root      204: 
1.1.1.2   root      205:     STMemory_WriteWord(LineABase-0*2,VDIPlanes);                     /* planes */
1.1       root      206:   }
                    207: }
                    208: 
1.1.1.2   root      209: 
                    210: /*-----------------------------------------------------------------------*/
1.1       root      211: /*
                    212:   This is called on completion of a VDI Trap, used to modify return structure for 
                    213: */
                    214: void VDI_Complete(void)
                    215: {
                    216:   unsigned short int OpCode;
                    217: 
                    218:   OpCode = STMemory_ReadWord(Control);
1.1.1.2   root      219:   /* Is 'Open Workstation', or 'Open Virtual Screen Workstation'? */
1.1.1.3   root      220:   if ( (OpCode==1) || (OpCode==100) )
                    221:   {
1.1.1.2   root      222:     STMemory_WriteWord(Intout,VDIWidth-1);                         /* IntOut[0] Width-1 */
                    223:     STMemory_WriteWord(Intout+1*2,VDIHeight-1);                    /* IntOut[1] Height-1 */
                    224:     STMemory_WriteWord(Intout+13*2,VDIColours);                    /* IntOut[13] #colours */
                    225:     STMemory_WriteWord(Intout+39*2,512);                           /* IntOut[39] #available colours */
1.1       root      226: 
1.1.1.2   root      227:     STMemory_WriteWord(LineABase-0x15a*2,VDIWidth-1);              /* WKXRez */
                    228:     STMemory_WriteWord(LineABase-0x159*2,VDIHeight-1);             /* WKYRez */
1.1       root      229: 
1.1.1.2   root      230:     VDI_LineA();                  /* And modify Line-A structure accordingly */
1.1       root      231:   }
                    232: }
                    233: 
1.1.1.2   root      234: 
                    235: /*-----------------------------------------------------------------------*/
1.1       root      236: /*
                    237:   Save desktop configuration file for VDI, eg desktop.inf(TOS 1.04) or newdesk.inf(TOS 2.06)
                    238: */
1.1.1.5 ! root      239: static void VDI_SaveDesktopInf(char *pszFileName,unsigned char *Script,long ScriptSize)
1.1       root      240: {
1.1.1.2   root      241:   /* Just save file */
                    242:   File_Save(pszFileName, Script, ScriptSize, FALSE);
1.1       root      243: }
                    244: 
1.1.1.2   root      245: 
                    246: /*-----------------------------------------------------------------------*/
1.1       root      247: /*
                    248:   Modify exisiting ST desktop configuration files to set resolution(keep user settings)
                    249: */
1.1.1.5 ! root      250: static void VDI_ModifyDesktopInf(char *pszFileName)
1.1       root      251: {
                    252:   long InfSize;
                    253:   unsigned char *pInfData;
                    254:   int i;
                    255: 
1.1.1.2   root      256:   /* Load our '.inf' file */
1.1       root      257:   pInfData = (unsigned char *)File_Read(pszFileName,NULL,&InfSize,NULL);
1.1.1.3   root      258:   if (pInfData)
                    259:   {
1.1.1.2   root      260:     /* Scan file for '#E' */
1.1       root      261:     i = 0;
1.1.1.3   root      262:     while(i<(InfSize-8))
                    263:     {
                    264:       if ( (pInfData[i]=='#') && (pInfData[i+1]=='E') )
                    265:       {
1.1.1.2   root      266:         /* Modify resolution */
1.1       root      267:         pInfData[i+7] = '1'+VDIRes;
                    268:         goto done_modify;
                    269:       }
                    270: 
                    271:       i++;
                    272:     }
                    273: 
                    274: done_modify:;
                    275:     /* And save */
1.1.1.2   root      276:     File_Save(pszFileName, pInfData, InfSize, FALSE);
1.1       root      277:     /* Free */
                    278:     Memory_Free(pInfData);
                    279:   }
                    280: }
                    281: 
1.1.1.2   root      282: 
                    283: /*-----------------------------------------------------------------------*/
1.1       root      284: /*
1.1.1.3   root      285:   Modify (or create) ST desktop configuration files so VDI boots up in
                    286:   correct color depth
1.1       root      287: */
                    288: void VDI_FixDesktopInf(void)
                    289: {
1.1.1.5 ! root      290:   char *szDesktopFileName, *szNewDeskFileName;
1.1       root      291: 
1.1.1.3   root      292:   if(!GEMDOS_EMU_ON)
                    293:   {
                    294:     /* Can't modify DESKTOP.INF when not using GEMDOS hard disk emulation */
                    295:     return;
                    296:   }
                    297: 
1.1.1.5 ! root      298:   szDesktopFileName = Memory_Alloc(2 * FILENAME_MAX);
        !           299:   szNewDeskFileName = szDesktopFileName + FILENAME_MAX;
        !           300: 
1.1       root      301:   /* Create filenames for hard-drive */
1.1.1.4   root      302:   GemDOS_CreateHardDriveFileName(2, "\\DESKTOP.INF", szDesktopFileName);
                    303:   GemDOS_CreateHardDriveFileName(2, "\\NEWDESK.INF", szNewDeskFileName);
1.1       root      304: 
                    305:   /* First, check if files exist(ie modify or replace) */
                    306:   if (!File_Exists(szDesktopFileName))
                    307:     VDI_SaveDesktopInf(szDesktopFileName,DesktopScript,sizeof(DesktopScript));
                    308:   VDI_ModifyDesktopInf(szDesktopFileName);
                    309: 
                    310:   if (!File_Exists(szNewDeskFileName))
                    311:     VDI_SaveDesktopInf(szNewDeskFileName,NewDeskScript,sizeof(NewDeskScript));
                    312:   VDI_ModifyDesktopInf(szNewDeskFileName);
1.1.1.5 ! root      313: 
        !           314:   Memory_Free(szDesktopFileName);
1.1       root      315: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.