/* Icon.c - Part of FlashNG - © 2001 Nogfx. */

#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/wb.h>
#include <proto/icon.h>

#include <exec/types.h>
#include <exec/ports.h>
#include <exec/memory.h>
#include <dos/dos.h>
#include <workbench/startup.h>
#include <workbench/workbench.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static struct DiskObject *diskobj;

STRPTR FLASHICON_NAME="FlashNG.exe";

__regargs BOOL GetDreamCDIcon(STRPTR name)
{
   if (name)
   {
      diskobj=GetDiskObject(name);
   }
   return (BOOL)(diskobj ? TRUE : FALSE);
}

__regargs char *GetTool(void)
{
   char *tool="SCREENMODE";
   char *quoi;
   char *def="YES";
 if (diskobj)
   {
      if (quoi = FindToolType(diskobj->do_ToolTypes, tool))
         {
          return (quoi);
         }
    }
   return (NULL); // SCREENMODE Tooltype Not found
}

char *InitToolTypes(void)
{
char *ert2;
BOOL test=TRUE;
if (IconBase=OpenLibrary("icon.library",0))
{
   test=GetDreamCDIcon(FLASHICON_NAME);
   if (test)
   {
     ert2=GetTool();
     FreeDiskObject(diskobj);
  }
  else test=FALSE;

CloseLibrary(IconBase);
                       }
else test=FALSE;
return(ert2);
}
/*
void main(void)
{
    ULONG ty;
    char *essai;

    essai=InitToolTypes();
    ty=strtoul(essai,NULL,16);
    printf("eee: %s ... conv: %x\n",essai,ty);
    if ((strlen(essai))==3) printf("Ca a marché !!\n");
    }
    */
