home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 144.lha / VScreen_Src / vScreen.h < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-21  |  4.6 KB  |  139 lines

  1. /*
  2.  *  VSCREEN.C       Creates virtual screens that can be larger than
  3.  *                  the actual display area of your monitor.  The virtual
  4. --MORE--(22%) *                  screen scrolls when the mouse moves off the edge of
  5.  *                  the display.
  6.  *
  7.  *                  Copyright 1988 by Davide P. Cervone, all rights reserved.
  8.  *
  9.  *                  You may may distibute this code as is, for non-commercial
  10.  *                  purposes, provided that this notice remains intact and the
  11.  *                  documentation file is distributed with it.
  12.  *
  13.  *                  You may not modify this code or incorporate it into your
  14.  *                  own programs without the permission of the author.
  15.  */
  16. /*
  17.  *  WARNING:  This code uses and even modifies the INTUITIONPRIVATE
  18.  *  area of the IntuitionBase structure.  Use it at your own risk.  It is
  19.  *  likely to break under a future release of Intuition.
  20.  */
  21. #define INTUITIONPRIVATE
  22. #include <exec/types.h>
  23. #include <exec/semaphores.h>
  24. --MORE--(24%)#include <exec/interrupts.h>
  25. #include <exec/memory.h>
  26. #include <devices/input.h>
  27. #include <graphics/sprite.h>
  28. #include <intuition/intuition.h>
  29. #include <intuition/intuitionbase.h>
  30. #include <intuition/screens.h>
  31. #include <libraries/dos.h>
  32. #ifndef MANX
  33.    #ifdef PROTO
  34.       #include <proto/intuition.h>
  35.       #include <proto/exec.h>
  36.       #include <proto/graphics.h>
  37.       #include <proto/layers.h>
  38.       #include <proto/dos.h>
  39.    #endif
  40. #endif
  41. #define USAGE       "VSCREEN width height [screen]"
  42. #define COPYRIGHT   "Copyright 1988 by Davide P. Cervone, all rights reserved"
  43. #define PORTNAME    "vScreenPort"
  44. --MORE--(26%)
  45. #define INTUITION_REV   0L
  46. #define GRAPHICS_REV    0L
  47. #define LAYERS_REV      0L
  48. #define ERROR_EXIT      RETURN_ERROR
  49. #define OK_EXIT         RETURN_OK
  50. extern struct IntuitionBase *IntuitionBase;
  51. extern struct GfxBase *GfxBase;
  52. #ifndef PROTO
  53. extern struct DOSBase *DOSBase;
  54. #endif
  55. /*
  56.  *  This structure is used to pass information from the Handler to the
  57.  *  loader.  It contins pointers to the variables that the loader will
  58.  *  have to initialize, and to the routines that it has to call, or 
  59.  *  SetFunction into the libraries.  A pointer to this structure is
  60.  *  stored in the MsgPort so that the loader can find and remove the handler
  61.  *  once it's job is done.
  62. --MORE--(28%) */
  63. struct vScreenInfo
  64. {
  65.    short MajVers,MinVers, LoadVers;     /* version of handler and loader */
  66.    char *Program;                       /* name of the handler program */
  67.    char *PortName;                      /* name of the public port */
  68.    long Segment;                        /* SegList loaded by loader */
  69.    struct Interrupt *HandlerInfo;       /* Input.Device handler */
  70.    struct IntuitionBase **IntuitionBase;
  71.    struct GfxBase **GfxBase;
  72.    struct Screen **VScreen;             /* the virtual screen */
  73.    SHORT *ScreenWidth,*ScreenHeight;    /* the new width and height */
  74.    SHORT *OldWidth,*OldHeight;          /* old screen size */
  75.    SHORT **RxOffset,**RyOffset;         /* pointer to RasInfo offsets */
  76.    SHORT *RxOffset2,*RyOffset2;         /* normalized offsets */
  77.    LONG  *LaceScreen,*LaceShift;        /* LACE screen? */
  78.    LONG  *HiResScreen,*HiResShift;      /* HIRES screen ? */
  79.    WORD  *OldMaxDH,*OldMaxDR,*OldMaxDW; /* old IntuitionBase MaxDisplays */
  80.    
  81.    /*
  82.     *  These routines are called by the loader:
  83. --MORE--(30%)    */
  84.    void (*SetVScreen)();
  85.    void (*ResetVScreen)();
  86.    void (*FixView)();
  87.    
  88.    /*
  89.     *  These routines replace the Intution and Graphics library routines:
  90.     */
  91.    
  92.    void (*aCloseScreen)();
  93.    void (*aBuildSysRequest)();
  94.    void (*aAutoRequest)();
  95.    void (*aLoadView)();
  96.    void (*aMoveSprite)();
  97.    
  98.    /*
  99.     *  These are the addresses of the JSR or JMP instructions that
  100.     *  need to be changed to call the old library vectors:
  101.     */
  102.    long *CloseScreenJmpTarget;
  103.    long *BuildSysRequestJmpTarget;
  104. --MORE--(32%)   long *AutoRequestJmpTarget;
  105.    long *LoadViewJmpTarget;
  106.    long *MoveSpriteJmpTarget;
  107.    
  108.    /*
  109.     *  These are the old function vectors returned by SetFunction(): 
  110.     */
  111.   
  112.    long OldCloseScreen;
  113.    long OldBuildSysRequest;
  114.    long OldAutoRequest;
  115.    long OldLoadView;
  116.    long OldMoveSprite;
  117. };
  118. /*
  119.  *  These macros give easy access to the vScreenInfo structure:
  120.  */
  121. #define VAR(x)      (*(vScreenData->x))
  122. #define var(x)      (vScreenData->x)
  123. --MORE--(33%)
  124. /*
  125.  *  External routine declarations:
  126.  */
  127. #ifndef PROTO
  128. extern struct Window *OpenWindow();
  129. extern struct IntuiMessage *GetMsg();
  130. extern APTR OpenLibrary();
  131. extern PLANEPTR AllocRaster();
  132. extern UBYTE *AllocMem();
  133. extern struct MsgPort *CreatePort();
  134. extern struct IOStdReq *CreateStdIO();
  135. extern LONG OpenDevice();
  136. extern struct MsgPort *FindPort();
  137. extern long LoadSeg();
  138. #endif
  139.