home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 19 / AACD19.BIN / AACD / Programming / MCC_GLArea / MCC_GLArea_Dev / GLArea_Demo / Useful / Misc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-01-01  |  2.2 KB  |  97 lines

  1. /*----------------------------------------------------
  2.   Misc.cc
  3.   Version 0.1
  4.   Date: 13.12.1998
  5.   Author: Bodmer Stephan (bodmer2@uni2a.unige.ch)
  6.   Note: Miscellenous help function
  7. -----------------------------------------------------*/
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11.  
  12. #include <proto/graphics.h>
  13. #include <proto/asl.h>
  14. #include <proto/dos.h>
  15.  
  16. #include <exec/exec.h>
  17. #include <intuition/intuition.h>
  18.  
  19. #include "Misc.h"
  20.  
  21. extern struct ExecBase *SysBase;
  22.  
  23. //---------- Check CPU --------
  24. int CheckCPU() {
  25.     int flags=(int) SysBase->AttnFlags;
  26.     // printf("AttnFlags:%d\n",flags);
  27.     if (flags&AFF_68040) {
  28.     // if (!strcmp(COMPILED_FOR_CPU_MODEL,"68040")) {
  29.     //     puts("68040 detected");
  30.     return MC68040;
  31.     }
  32.     else if (flags&AFF_68030) {
  33.     return MC68030;
  34.     }
  35.     else if (flags&AFF_68020) {
  36.     return MC68020;
  37.     }
  38.     else if (flags&AFF_68010) {
  39.     return MC68010;
  40.     }
  41.     else {
  42.     return MC68000;
  43.     };
  44.     // printf("AFF_68040:%d\n",AFF_68040);
  45. }
  46. BOOL CheckFPU() {
  47.     int flags=(int) SysBase->AttnFlags;
  48.     if (flags&AFF_68881) {
  49.     return TRUE;
  50.     }
  51.     else if (flags&AFF_68882) {
  52.     return TRUE;
  53.     }
  54.     else {
  55.     return FALSE;
  56.     };
  57. }
  58.  
  59. //----------------- Return the display mode name -------------------------
  60. void ConvertDisplayID (char *st,int id) {
  61.    struct NameInfo ni;
  62.    if (GetDisplayInfoData(NULL,
  63.               (UBYTE *) &ni,
  64.               sizeof(struct NameInfo),
  65.               DTAG_NAME,
  66.               (ULONG) id)) {
  67.       strncpy(st,(char *) ni.Name,255);
  68.       // puts("Not NULL");
  69.       // return ni.Name;
  70.    };
  71. }
  72.  
  73. //---------- OpenASL -----------
  74. BOOL OpenASL (char *title, char *sdir, char *sname , char *filename, char *dir, char *name) {
  75.     BOOL rep=FALSE;
  76.     struct FileRequester *fr=NULL;
  77.     // puts("In OpenASL");
  78.  
  79.     struct TagItem FRTags[] = { {ASL_Hail, (ULONG) title},
  80.                 {ASL_Dir, (ULONG) sdir},
  81.                 {ASL_File, (ULONG) sname},
  82.                 {TAG_DONE} };
  83.     fr=AllocFileRequest();
  84.     rep=(BOOL) AslRequest(fr,FRTags);
  85.     // printf("rep=%d\n",rep);
  86.     // puts ("ok");
  87.     if (rep) {
  88.     strcpy(name,fr->rf_File);
  89.     strcpy(dir,fr->rf_Dir);
  90.     strcpy(filename,fr->rf_Dir);
  91.     AddPart(filename,name,255);
  92.     };
  93.     // printf("Load File Found:%s\n",filename);
  94.     FreeFileRequest(fr);
  95.     return rep;
  96. }
  97.