Ejemplo n.º 1
0
/*
*       Part 1 of early emudesk.inf processing
*
*       This has one function: determine if we need to change resolutions
*       (from #E).  If so, we set gl_changerez and gl_nextrez appropriately.
*/
static void process_inf1(void)
{
        WORD    env1, env2;
#if CONF_WITH_SHIFTER
        WORD    mode;
#endif
        char    *pcurr;

        gl_changerez = 0;       /* assume no change */

        for (pcurr = infbuf; *pcurr; )
        {
          if ( *pcurr++ != '#' )
            continue;
          if (*pcurr++ == 'E')          /* #E 3A 11 FF 02               */
          {                             /* desktop environment          */
            pcurr = scan_2(pcurr, &env1);
            ev_dclick(env1 & 0x07, TRUE);
            pcurr = scan_2(pcurr, &env2);
            if (*pcurr == '\r')         /* no video info saved */
              break;

#if CONF_WITH_SHIFTER
            pcurr = scan_2(pcurr, &env1);
            pcurr = scan_2(pcurr, &env2);
            mode = (env1 << 8) | (env2 & 0x00ff);
            mode = check_moderez(mode);
            if (mode == 0)              /* no change required */
              break;
            if (mode > 0)               /* need to set Falcon mode */
            {
              gl_changerez = 2;
              gl_nextrez = mode;
            }
            else                        /* set ST/TT rez */
            {
              gl_changerez = 1;
              gl_nextrez = (mode & 0x00ff) + 2;
            }
#endif /* CONF_WITH_SHIFTER */
          }
        }
}
Ejemplo n.º 2
0
/*
 *  Part 1 of early emudesk.inf processing
 *
 *  This has one function: determine if we need to change resolutions
 *  (from #E).  If so, we set gl_changerez and gl_nextrez appropriately.
 */
static void process_inf1(void)
{
#if CONF_WITH_ATARI_VIDEO
    WORD    env1, env2;
    WORD    mode;
#endif
    char    *pcurr;

    gl_changerez = 0;           /* assume no change */

    for (pcurr = infbuf; *pcurr; )
    {
        if ( *pcurr++ != '#' )
            continue;
        if (*pcurr++ == 'E')            /* #E 3A 11 FF 02               */
        {                               /* desktop environment          */
            pcurr += 6;                 /* skip over non-video preferences */
            if (*pcurr == '\r')         /* no video info saved */
                break;

#if CONF_WITH_ATARI_VIDEO
            pcurr = scan_2(pcurr, &env1);
            pcurr = scan_2(pcurr, &env2);
            mode = (env1 << 8) | (env2 & 0x00ff);
            mode = check_moderez(mode);
            if (mode == 0)              /* no change required */
                break;
            if (mode > 0)               /* need to set Falcon mode */
            {
                gl_changerez = 2;
                gl_nextrez = mode;
            }
            else                        /* set ST/TT rez */
            {
                gl_changerez = 1;
                gl_nextrez = (mode & 0x00ff) + 2;
            }
#endif /* CONF_WITH_ATARI_VIDEO */
        }
    }
}
Ejemplo n.º 3
0
/*
 *  Part 2 of early emudesk.inf processing
 *
 *  This has two functions:
 *      1. Determine the auto-run program to be started (from #Z).
 *      2. Set the double-click speed (from #E).  This is done here
 *         in case we have an auto-run program.
 *
 *  Returns:
 *      TRUE if initial program is a GEM program (normal)
 *      FALSE if initial program is character-mode (only if an autorun
 *      entry exists, and it is for a character-mode program).
 */
static BOOL process_inf2(void)
{
    WORD    env, isgem = TRUE;
    char    *pcurr;
    BYTE    tmp;

    pcurr = infbuf;
    while (*pcurr)
    {
        if ( *pcurr++ != '#' )
            continue;
        tmp = *pcurr;
        if (tmp == 'E')             /* #E 3A 11                     */
        {                           /* desktop environment          */
            pcurr += 2;
            scan_2(pcurr, &env);
            ev_dclick(env & 0x07, TRUE);
        }
        else if (tmp == 'Z')        /* something like "#Z 01 C:\THING.APP@" */
        {
            BYTE *tmpptr1, *tmpptr2;
            pcurr += 2;
            scan_2(pcurr, &isgem);  /* 00 => not GEM, otherwise GEM */
            pcurr += 3;
            tmpptr1 = pcurr;
            while (*pcurr && (*pcurr != '@'))
                ++pcurr;
            *pcurr = 0;
            tmpptr2 = sh_name(tmpptr1);
            *(tmpptr2-1) = 0;
            KDEBUG(("Found #Z entry in EMUDESK.INF: path=%s, prg=%s\n",tmpptr1,tmpptr2));
            sh_wdef(tmpptr2, tmpptr1);
            ++pcurr;
        }
    }

    return isgem ? TRUE : FALSE;
}
Ejemplo n.º 4
0
/*
*       Part 2 of early emudesk.inf processing
*
*       This has two functions:
*        1. Determine the auto-run program to be started (from #Z).
*        2. Set the double-click speed (from #E).  This is done here
*           in case we have an auto-run program.
*/
static void process_inf2(void)
{
        WORD    env;
        char    *pcurr;
        BYTE    tmp;

        pcurr = infbuf;
        while (*pcurr)
        {
          if ( *pcurr++ != '#' )
            continue;
          tmp = *pcurr;
          if (tmp == 'E')               /* #E 3A 11                     */
          {                             /* desktop environment          */
            pcurr += 2;
            scan_2(pcurr, &env);
            ev_dclick(env & 0x07, TRUE);
          }
          else if (tmp == 'Z')      /* something like "#Z 01 C:\THING.APP@" */
          {
            BYTE *tmpptr1, *tmpptr2;
            pcurr += 5;
            tmpptr1 = pcurr;
            while (*pcurr && (*pcurr != '@'))
              ++pcurr;
            *pcurr = 0;
            tmpptr2 = sh_name(tmpptr1);
            *(tmpptr2-1) = 0;
#if DBG_GEMINIT
            kprintf("Found #Z entry in EMUDESK.INF with path=%s and prg=%s\n",
                    tmpptr1, tmpptr2);
#endif
            sh_wdef(tmpptr2, tmpptr1);
            ++pcurr;
          }
        }
}
Ejemplo n.º 5
0
/*
 *  Initialize the application list by reading in the EMUDESK.INF
 *  file, either from memory or from the disk if the shel_get
 *  indicates no message is there.
 */
void app_start(void)
{
    WORD i, x, y;
    ANODE *pa;
    WSAVE *pws;
    BYTE *pcurr, *ptmp, *pauto = NULL;
    WORD envr, xcnt, ycnt, xcent, wincnt, dummy;

    /* remember start drive */
    gl_stdrv = dos_gdrv();

    G.g_pbuff = gl_buffer;

    for (i = NUM_ANODES - 2; i >= 0; i--)
        G.g_alist[i].a_next = &G.g_alist[i + 1];
    G.g_ahead = (ANODE *) NULL;
    G.g_aavail = G.g_alist;
    G.g_alist[NUM_ANODES - 1].a_next = (ANODE *) NULL;

    app_rdicon();

    G.g_wicon = (12 * gl_wschar) + (2 * G.g_iblist[0].ib_xtext);
    G.g_hicon = G.g_iblist[0].ib_hicon + gl_hschar + 2;

    xcnt = G.g_wdesk / (G.g_wicon+MIN_WINT);/* icon count */
    G.g_icw = G.g_wdesk / xcnt;             /* width */

    ycnt = G.g_hdesk / (G.g_hicon+MIN_HINT);/* icon count */
    G.g_ich = G.g_hdesk / ycnt;             /* height */

    shel_get(gl_afile, SIZE_AFILE);
    if (gl_afile[0] != '#')                 /* invalid signature    */
    {                                       /*   so read from disk  */
        LONG ret;
        WORD fh;
        char inf_file_name[16];
        strcpy(inf_file_name, INF_FILE_NAME);
        inf_file_name[0] += gl_stdrv;         /* Adjust drive letter  */
        ret = dos_open(inf_file_name, 0x0);
        if (ret >= 0L)
        {
            fh = (WORD) ret;
            ret = dos_read(fh, SIZE_AFILE, gl_afile);
            G.g_afsize = (ret < 0L) ? 0L : ret;
            dos_close(fh);
            gl_afile[G.g_afsize] = '\0';
        }
    }

    /* If there's still no desktop.inf data, use built-in now: */
    if (gl_afile[0] != '#')
    {
        LONG drivemask;
        char *text;
        int icon_index = 0;
        int drive_x = 0, drive_y = 0;
        int trash_x, trash_y;
        int icon_type;
        char drive_letter;

        /* Environment and Windows */
        strcat(gl_afile, desk_inf_data1);

        /* Scan for valid drives: */
        drivemask = dos_sdrv(dos_gdrv());
        for (i = 0; i < BLKDEVNUM; i++)
        {
            if (drivemask&(1L<<i))
            {
                x = strlen(gl_afile);
                drive_x = icon_index % xcnt; /* x position */
                drive_y = icon_index / xcnt; /* y position */
                icon_type = (i > 1) ? 0 /* Hard disk */ : 1 /* Floppy */;
                drive_letter = 'A' + i;
                rsrc_gaddr(R_STRING, STDISK, (void **)&text);
                sprintf(gl_afile + x, "#M %02X %02X %02X FF %c %s %c@ @\r\n",
                        drive_x, drive_y, icon_type, drive_letter, text, drive_letter);
                icon_index++;
            }
        }

        /* Copy core data part 2 */
        strcat(gl_afile, desk_inf_data2);

        /* add Trash icon to end */
        x = strlen(gl_afile);
        trash_x = 0;            /* Left */
        trash_y = ycnt-1;       /* Bottom */
        if (drive_y >= trash_y) /* if the last drive icon overflows over */
            trash_x = xcnt-1;   /*  the trash row, force trash to right  */
        rsrc_gaddr(R_STRING, STTRASH, (void **)&text);
        sprintf(gl_afile + x, "#T %02X %02X 03 FF   %s@ @\r\n",
                trash_x, trash_y, text);
        G.g_afsize = strlen(gl_afile);
    }

    wincnt = 0;
    inf_rev_level = 0;
    pcurr = gl_afile;

    while(*pcurr)
    {
        if (*pcurr++ != '#')            /* look for start of line */
            continue;

        switch(*pcurr)
        {
        case 'R':                       /* revision level */
            pcurr++;
            pcurr = scan_2(pcurr,&inf_rev_level);
            break;
        case 'Z':                       /* autorun: Z nn pathname@ */
            pcurr = scan_str(pcurr+5,&pauto);   /* save pathname in buffer */
            break;                              /* (a bit wasteful)        */
        case 'T':                       /* Trash */
        case 'M':                       /* Media (Hard/Floppy)  */
        case 'G':                       /* GEM Application      */
        case 'Y':                       /* GEM App. with parms  */
        case 'F':                       /* File (DOS w/o parms) */
        case 'P':                       /* Parm (DOS w/ parms)  */
        case 'D':                       /* Directory            */
        case 'I':                       /* Executable file icon     */
        case 'N':                       /* Non-executable file icon */
            pa = app_alloc(TRUE);
            if (!pa)                    /* paranoia */
                return;
            pcurr = app_parse(pcurr, pa);
            if ((pa->a_type == AT_ISFILE) && pauto)
            {                           /* autorun exists & not yet merged */
                if (strcmp(pauto,pa->a_pappl) == 0)
                {
                    pa->a_flags |= AF_AUTORUN;  /* it's this program */
                    pauto = NULL;               /*  (and no other)   */
                }
            }
            break;
        case 'W':                       /* Window               */
            pcurr++;
            if (wincnt < NUM_WNODES)
            {
                pws = &G.g_cnxsave.cs_wnode[wincnt];
                pcurr = scan_2(pcurr, &dummy);
                pcurr = scan_2(pcurr, &pws->vsl_save);
/* BugFix       */
                pcurr = scan_2(pcurr, &pws->x_save);
                pws->x_save *= gl_wchar;
                pcurr = scan_2(pcurr, &pws->y_save);
                pws->y_save *= gl_hchar;
                pcurr = scan_2(pcurr, &pws->w_save);
                pws->w_save *= gl_wchar;
                pcurr = scan_2(pcurr, &pws->h_save);
                pws->h_save *= gl_hchar;
/* */
                pcurr = scan_2(pcurr, &pws->obid_save);
                ptmp = pws->pth_save;
                pcurr++;
                while(*pcurr != '@')
                    *ptmp++ = *pcurr++;
                *ptmp = '\0';
                wincnt += 1;
            }
            break;
        case 'E':                       /* Environment */
            pcurr++;
            pcurr = scan_2(pcurr, &envr);
            G.g_cnxsave.cs_view = ( (envr & INF_E1_VIEWTEXT) != 0);
            G.g_cnxsave.cs_sort = ( (envr & INF_E1_SORTMASK) >> 5);
            G.g_cnxsave.cs_confdel = ( (envr & INF_E1_CONFDEL) != 0);
            G.g_cnxsave.cs_confcpy = ( (envr & INF_E1_CONFCPY) != 0);
            G.g_cnxsave.cs_dblclick = envr & INF_E1_DCMASK;

            pcurr = scan_2(pcurr, &envr);
            G.g_cnxsave.cs_confovwr = ( (envr & INF_E2_ALLOWOVW) == 0);
            G.g_cnxsave.cs_mnuclick = ( (envr & INF_E2_MNUCLICK) != 0);
            menu_click(G.g_cnxsave.cs_mnuclick, 1); /* tell system */
            if (envr & INF_E2_IDTDATE)
                G.g_cnxsave.cs_datefmt = DATEFORM_IDT;
            else
                G.g_cnxsave.cs_datefmt = (envr & INF_E2_DAYMONTH) ? DATEFORM_DMY : DATEFORM_MDY;
            if (envr & INF_E2_IDTTIME)
                G.g_cnxsave.cs_timefmt = TIMEFORM_IDT;
            else
                G.g_cnxsave.cs_timefmt = (envr & INF_E2_24HCLOCK) ? TIMEFORM_24H : TIMEFORM_12H;
            sound(FALSE, !(envr & INF_E2_SOUND), 0);

            pcurr = scan_2(pcurr, &dummy);  /* skip video stuff */
            pcurr = scan_2(pcurr, &dummy);

            pcurr = scan_2(pcurr, &envr);
            if (envr & INF_E5_NOSORT)
                G.g_cnxsave.cs_sort = CS_NOSORT;
            break;
        }
    }

    for (pa = G.g_ahead; pa; pa = pa->a_next)
    {
        if (pa->a_flags & AF_ISDESK)
        {
            x = pa->a_xspot * G.g_icw;
            y = pa->a_yspot * G.g_ich + G.g_ydesk;
            snap_disk(x, y, &pa->a_xspot, &pa->a_yspot, 0, 0);
        }
    }

    /* set up outlines for dragging files displayed as icons */
    G.g_nmicon = 9;     /* number of points */
    memset(G.g_xyicon, 0, sizeof(G.g_xyicon));
    xcent = (G.g_wicon - G.g_iblist[0].ib_wicon) / 2;
    G.g_xyicon[0] = xcent;
    G.g_xyicon[2] = xcent;
    G.g_xyicon[3] = G.g_hicon-gl_hschar-2;
    G.g_xyicon[5] = G.g_hicon-gl_hschar-2;
    G.g_xyicon[7] = G.g_hicon;
    G.g_xyicon[8] = G.g_wicon;
    G.g_xyicon[9] = G.g_hicon;
    G.g_xyicon[10] = G.g_wicon;
    G.g_xyicon[11] = G.g_hicon-gl_hschar-2;
    G.g_xyicon[12] = G.g_wicon-xcent;
    G.g_xyicon[13] = G.g_hicon-gl_hschar-2;
    G.g_xyicon[14] = G.g_wicon-xcent;
    G.g_xyicon[16] = xcent;

    /* set up outlines for dragging files displayed as text */
    G.g_nmtext = 5;     /* number of points */
    memset(G.g_xytext, 0, sizeof(G.g_xytext));
    G.g_xytext[2] = gl_wchar * DRAG_BOX_WIDTH;
    G.g_xytext[4] = gl_wchar * DRAG_BOX_WIDTH;
    G.g_xytext[5] = gl_hchar;
    G.g_xytext[7] = gl_hchar;
}
Ejemplo n.º 6
0
/*
 *  Parse a single line from the EMUDESK.INF file
 */
static BYTE *app_parse(BYTE *pcurr, ANODE *pa)
{
    WORD temp;

    pa->a_flags = 0;

    switch(*pcurr)
    {
    case 'T':                             /* Trash */
        pa->a_type  = AT_ISTRSH;
        pa->a_flags = AF_ISCRYS | AF_ISDESK;
        break;
    case 'M':                             /* Storage Media        */
        pa->a_type = AT_ISDISK;
        pa->a_flags = AF_ISCRYS | AF_ISDESK;
        break;
    case 'Y':                             /* GEM App needs parms  */
        pa->a_flags = AF_ISPARM;
        /* drop thru */
    case 'G':                             /* GEM App no parms     */
        pa->a_type = AT_ISFILE;
        pa->a_flags |= AF_ISCRYS;
        break;
    case 'P':                             /* TOS App needs parms  */
        pa->a_flags = AF_ISPARM;
        /* drop thru */
    case 'F':                             /* TOS App no parms     */
        pa->a_type = AT_ISFILE;
        break;
    case 'D':                             /* Directory (Folder)   */
        pa->a_type = AT_ISFOLD;
        break;
    case 'I':                             /* Executable file      */
        pa->a_flags = AF_ISEXEC;
        /* drop thru */
    case 'N':                             /* Non-executable file  */
        pa->a_type = AT_ISFILE;
        pa->a_flags |= AF_WINDOW;
        break;
    }
    pcurr++;

    if (pa->a_flags & AF_ISDESK)
    {
        pcurr = scan_2(pcurr, &pa->a_xspot);
        pcurr = scan_2(pcurr, &pa->a_yspot);
    }

    pcurr = scan_2(pcurr, &pa->a_aicon);
    if (pa->a_aicon >= NUM_IBLKS)
        pa->a_aicon = IG_APPL;
    pcurr = scan_2(pcurr, &pa->a_dicon);
    if (pa->a_dicon >= NUM_IBLKS)
        pa->a_dicon = IG_DOCU;
    pcurr++;

    /*
     * convert icon numbers in EMUDESK.INF revision 0
     */
    if (inf_rev_level == 0)
    {
        if (pa->a_aicon == IG_APPL_REV0)
            pa->a_aicon = IG_APPL;
        if (pa->a_dicon == IG_DOCU_REV0)
            pa->a_dicon = IG_DOCU;
    }

    if (pa->a_flags & AF_ISDESK)
    {
        pa->a_letter = (*pcurr == ' ') ? '\0' : *pcurr;
        pcurr += 2;
    }
    pcurr = scan_str(pcurr, &pa->a_pappl);
    pcurr = scan_str(pcurr, &pa->a_pdata);
    if (*pcurr == ' ')          /* new format */
    {
        pcurr++;
        if (*pcurr & INF_AT_APPDIR)
            pa->a_flags |= AF_APPDIR;
        if (*pcurr & INF_AT_ISFULL)
            pa->a_flags |= AF_ISFULL;
        pcurr = scan_2(pcurr+1, &temp);
        pa->a_funkey = temp;
        pcurr++;
    }
    pcurr = scan_str(pcurr, &pa->a_pargs);

    return pcurr;
}