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

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

unix.superglobalmegacorp.com

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