Update of /cvsroot/arcem/arcem/amiga
In directory vz-cvs-4.sog:/tmp/cvs-serv17456/arcem/amiga

Modified Files:
        ArcEm.guide ArcEm.info ControlPane.c DispKbd.c arexx.c 
        filecalls.c platform.h sound.c wb.c 
Added Files:
        arcem-os3.info 
Log Message:
Merge arcem-fast to trunk



Index: arexx.c
===================================================================
RCS file: /cvsroot/arcem/arcem/amiga/arexx.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- arexx.c     10 May 2008 11:23:39 -0000      1.3
+++ arexx.c     12 May 2012 17:34:51 -0000      1.4
@@ -35,9 +35,9 @@
 
 void ARexx_Init()
 {
-       if((ARexxBase = IExec->OpenLibrary((char *)&"arexx.class",51)))
+       if((ARexxBase = OpenLibrary((char *)&"arexx.class",51)))
        {
-               if(IARexx = (struct ARexxIFace 
*)IExec->GetInterface(ARexxBase,(char *)&"main",1,NULL))
+               if(IARexx = (struct ARexxIFace *)GetInterface(ARexxBase,(char 
*)&"main",1,NULL))
                {
                
                        arexx_obj = ARexxObject,
@@ -62,12 +62,12 @@
 void ARexx_Cleanup()
 {
        if(arexx_obj)
-               IIntuition->DisposeObject(arexx_obj);
+               DisposeObject(arexx_obj);
 
        if(IARexx)
        {
-               IExec->DropInterface((struct Interface *)IARexx);
-               IExec->CloseLibrary(ARexxBase);
+               DropInterface((struct Interface *)IARexx);
+               CloseLibrary(ARexxBase);
        }
 }
 

--- NEW FILE: arcem-os3.info ---
(This appears to be a binary file; contents omitted.)

Index: ArcEm.info
===================================================================
RCS file: /cvsroot/arcem/arcem/amiga/ArcEm.info,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
Binary files /tmp/cvsf4AD1P and /tmp/cvsnIAFqj differ

Index: filecalls.c
===================================================================
RCS file: /cvsroot/arcem/arcem/amiga/filecalls.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- filecalls.c 7 Apr 2006 19:00:47 -0000       1.1
+++ filecalls.c 12 May 2012 17:34:51 -0000      1.2
@@ -23,9 +23,9 @@
  *
  * @param sPath Location of directory to scan
  * @param hDir Pointer to a Directory struct to fill in
- * @returns 1 on success 0 on failure
+ * @returns true on success false on failure
  */
-unsigned Directory_Open(const char *sPath, Directory *hDirectory)
+bool Directory_Open(const char *sPath, Directory *hDirectory)
 {
   assert(sPath);
   assert(*sPath);
@@ -34,9 +34,9 @@
   hDirectory->hDir = opendir(sPath);
 
   if(NULL == hDirectory->hDir) {
-    return 0;
+    return false;
   } else {
-    return 1;
+    return true;
   }
 }
 
@@ -81,9 +81,9 @@
  *
  * @param sPath Path to file to check
  * @param phFileInfo pointer to FileInfo struct to fill in
- * @returns 0 on failure 1 on success
+ * @returns false on failure true on success
  */
-unsigned char File_GetInfo(const char *sPath, FileInfo *phFileInfo)
+bool File_GetInfo(const char *sPath, FileInfo *phFileInfo)
 {
   struct stat hEntryInfo;
 
@@ -93,25 +93,25 @@
   if (stat(sPath, &hEntryInfo) != 0) {
     fprintf(stderr, "Warning: could not stat() entry \'%s\': %s\n",
             sPath, strerror(errno));
-    return 0;
+    return false;
   }
   
   /* Initialise components */
-  phFileInfo->bIsRegularFile = 0;
-  phFileInfo->bIsDirectory   = 0;
+  phFileInfo->bIsRegularFile = false;
+  phFileInfo->bIsDirectory   = false;
 
   if (S_ISREG(hEntryInfo.st_mode)) {
-    phFileInfo->bIsRegularFile = 1;
+    phFileInfo->bIsRegularFile = true;
   }
 
   if (S_ISDIR(hEntryInfo.st_mode)) {
-    phFileInfo->bIsDirectory = 1;
+    phFileInfo->bIsDirectory = true;
   }
   
   /* Fill in Size */
   phFileInfo->ulFilesize = hEntryInfo.st_size;
   
   /* Success! */
-  return 1;
+  return true;
 }
 

Index: sound.c
===================================================================
RCS file: /cvsroot/arcem/arcem/amiga/sound.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sound.c     24 Sep 2006 13:14:04 -0000      1.2
+++ sound.c     12 May 2012 17:34:51 -0000      1.3
@@ -8,116 +8,63 @@
 #include "platform.h"
 #include "../armdefs.h"
 #include "../arch/sound.h"
+#include "../arch/displaydev.h"
 
 BPTR audioh = 0;
 
 static unsigned long sampleRate = 44100;
-static unsigned long bufferSize = 64;
-
-/* This is the size of the gap between sound_poll doing something. */
-static unsigned long delayTotal = 5; // 100
-static unsigned long delayProgress = 0;
-
-static SoundData *buffer = NULL;
 
-void
-sound_poll(void)
-{
-  delayProgress++;
-  if (delayProgress >= delayTotal)
-       {
-           delayProgress = 0;
-
-             if (SoundDMAFetch(buffer) == 1)
-                       {
-                       return;
-               }
-
-               IDOS->Write(audioh,buffer,64);
-
-    }
-}
+SoundData sound_buffer[256*2]; /* Must be >= 2*Sound_BatchSize! */
 
 int openaudio(void)
 {
-       STRPTR audiof = NULL;
+       char audiof[256];
 
-       if(audiof = 
IUtility->ASPrintf("AUDIO:BITS/16/C/2/F/%lu/T/SIGNED",sampleRate))
-       {
-               if(!(audioh = IDOS->Open(audiof,MODE_NEWFILE)))
-               {
-               fprintf(stderr, "Could not open audio: device\n");
-               return -1;
-               }
-               IExec->FreeVec(audiof);
-       }
-       else
+       sprintf(audiof, "AUDIO:BITS/16/C/2/F/%lu/T/SIGNED\0", sampleRate);
+
+       if(!(audioh = Open(audiof,MODE_NEWFILE)))
        {
+               fprintf(stderr, "Could not open audio: device\n");
                return -1;
        }
+
+       return 0;
 }
 
-int
-sound_init(void)
+SoundData *Sound_GetHostBuffer(int32_t *destavail)
 {
-//     We only need utility.library in the sound routine, so opening it here.
-
-       if(UtilityBase = IExec->OpenLibrary("utility.library",51))
-       {
-               IUtility = IExec->GetInterface(UtilityBase,"main",1,NULL);
-       }
-       else
-       {
-               return -1;
-       }
+       /* Just assume we always have enough space for the max batch size */
+       *destavail = sizeof(sound_buffer)/(sizeof(SoundData)*2);
+       return sound_buffer;
+}
 
-       if(openaudio() == -1)
-               return -1;
+void Sound_HostBuffered(SoundData *buffer,int32_t numSamples)
+{
+       numSamples *= 2;
 
-  buffer = IExec->AllocVec(bufferSize,MEMF_CLEAR);
-  if (!buffer) {
-    fprintf(stderr, "sound_init(): Out of memory\n");
-    exit(EXIT_FAILURE);
-  }
+       /* TODO - Adjust Sound_FudgeRate to fine-tune how often we receive new 
data */
 
-  return 0;
+       Write(audioh,buffer,numSamples*sizeof(SoundData));
 }
 
-/**
- * sound_setSampleRate
- *
- * Set the sample rate of sound, using
- * the period specified in microseconds.
- *
- * @param period period of sample in microseconds
- */
-void
-sound_setSampleRate(unsigned long period)
+int
+Sound_InitHost(ARMul_State *state)
 {
-  /* freq = 1 / (period * 10^-6) */
+       if(openaudio() == -1)
+               return -1;
 
-  if (period != 0) {
-    sampleRate = 1000000 / period;
-  } else {
-    sampleRate = 44100;
-  }
+       /* TODO - Tweak these as necessary */
+       eSound_StereoSense = Stereo_LeftRight;
 
-  printf("asked to set sample rate to %lu\n", sampleRate);
+       Sound_BatchSize = 256;
 
-       IDOS->Close(audioh);    
-       openaudio();
+       Sound_HostRate = sampleRate<<10;
 
-  printf("set sample rate to %lu\n", sampleRate);
+       return 0;
 }
 
 void sound_exit(void)
 {
-       IExec->FreeVec(buffer);
-       IDOS->Close(audioh);
-
-       if(IUtility)
-       {
-               IExec->DropInterface((struct Interface *)IUtility);
-               IExec->CloseLibrary(UtilityBase);
-       }
+//     IExec->FreeVec(buffer);
+       Close(audioh);
 }

Index: platform.h
===================================================================
RCS file: /cvsroot/arcem/arcem/amiga/platform.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- platform.h  20 Apr 2008 11:09:39 -0000      1.5
+++ platform.h  12 May 2012 17:34:51 -0000      1.6
@@ -1,56 +1,43 @@
+#ifndef AMIGA_PLATFORM_H
+#define AMIGA_PLATFORM_H 1
+
 #include <intuition/intuition.h>
 #include <proto/icon.h>
 #include <proto/exec.h>
 #include <proto/dos.h>
 #include <proto/asl.h>
+#ifdef __amigaos4__ // weird _NewObject error
 #include <proto/intuition.h>
+#endif
 #include <proto/graphics.h>
 #include <proto/utility.h>
 //#include <proto/input.h>
 //#include <proto/picasso96api.h>
 
+#ifdef __amigaos4__
 struct Library *ExecBase;
-struct ExecIFace *IExec;
 struct Library *IntuitionBase;
-struct IntuitionIFace *IIntuition;
-//struct Library *P96Base;
-//struct P96IFace *IP96;
 struct Library *GfxBase;
-struct GraphicsIFace *IGraphics;
 struct Library *DOSBase;
-struct DOSIFace *IDOS;
 struct Library *AslBase;
-struct AslIFace *IAsl;
 struct Library *IconBase;
-struct IconIFace *IIcon;
 struct Library *UtilityBase;
-struct UtilityIFace *IUtility;
 //struct Device *inputdevice;
 
-extern int force8bit;
+struct ExecIFace *IExec;
+struct IntuitionIFace *IIntuition;
+struct GraphicsIFace *IGraphics;
+struct DOSIFace *IDOS;
+struct AslIFace *IAsl;
+struct IconIFace *IIcon;
+struct UtilityIFace *IUtility;
+#else
+#define IDCMP_EXTENDEDMOUSE 0
+#endif
 
 extern void cleanup(void);
 extern void sound_exit(void);
 
-struct XColor
-{
-       ULONG red;
-       ULONG green;
-       ULONG blue;
-};
-
-  struct {
-    char *ImageData,*CursorImageData;
-
-    /* Map from host memory contents to 'pixel' value for putpixel */
-    unsigned long pixelMap[256];
-
-    /* Map from host memory contents to 'pixel' value for putpixel in cursor*/
-    unsigned long cursorPixelMap[4];
-    int red_shift,red_prec;
-    int green_shift,green_prec;
-    int blue_shift,blue_prec;
-
-       struct Window *window;
-
-  } HostDisplay;
+int force8bit;
+int swapmousebuttons;
+#endif

Index: DispKbd.c
===================================================================
RCS file: /cvsroot/arcem/arcem/amiga/DispKbd.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- DispKbd.c   10 May 2008 10:45:42 -0000      1.14
+++ DispKbd.c   12 May 2012 17:34:51 -0000      1.15
@@ -2,22 +2,31 @@
 /* Some code based on DispKbd.c for other platforms                            
  */
 
 #include <string.h>
+#include <limits.h>
 
 #include "../armdefs.h"
 #include "armarc.h"
 #include "../arch/keyboard.h"
-#include "DispKbd.h"
+#include "displaydev.h"
 #include "KeyTable.h"
[...1627 lines suppressed...]
-
-    case 0xe0:
-#ifdef DEBUG_VIDCREGS
-      fprintf(stderr,"VIDC Control register val=0x%x\n",val);
+#if 0
+       return DisplayDev_Set(state,&SDD_DisplayDev);
+#else
+       return DisplayDev_Set(state,&PDD_DisplayDev);
 #endif
-      VideoRelUpdateAndForce(DC.MustRedraw,VIDC.ControlReg,val & 0xffff);
-       
ChangeDisplayMode(state,(VIDC.Horiz_DisplayEnd-VIDC.Horiz_DisplayStart)*2,VIDC.Vert_DisplayEnd-VIDC.Vert_DisplayStart,(VIDC.ControlReg
 & 0xc)>>2);
-      break;
-
-    default:
-      fprintf(stderr,"Write to unknown VIDC register reg=0x%x 
val=0x%x\n",addr,val);
-      break;
-
-  }; /* Register switch */
 }
-

Index: ControlPane.c
===================================================================
RCS file: /cvsroot/arcem/arcem/amiga/ControlPane.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ControlPane.c       7 Apr 2006 19:00:47 -0000       1.1
+++ ControlPane.c       12 May 2012 17:34:51 -0000      1.2
@@ -5,7 +5,6 @@
 #include "../armdefs.h"
 #include "archio.h"
 #include "armarc.h"
-#include "DispKbd.h"
 #include "ControlPane.h"
 
 void ControlPane_Init(ARMul_State *state)

Index: wb.c
===================================================================
RCS file: /cvsroot/arcem/arcem/amiga/wb.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- wb.c        20 Apr 2008 11:11:36 -0000      1.3
+++ wb.c        12 May 2012 17:34:51 -0000      1.4
@@ -5,13 +5,11 @@
  *  set by tooltypes.                                          */
 
 #include <workbench/startup.h>
-
 #include <stdio.h>
 
 #include "ArcemConfig.h"
 #include "platform.h"
-
-int force8bit=0;
+#include "displaydev.h"
 
 void wblaunch(struct WBStartup *);
 void closewblibs(void);
@@ -22,11 +20,10 @@
        /* We only need these libraries to read tooltypes, so if they don't open
                we can just skip the tooltypes and carry on */
 
-       if(IIcon)
-       {
-               IExec->DropInterface((struct Interface *)IIcon);
-               IExec->CloseLibrary(IconBase);
-       }
+#ifdef __amigaos4__
+       if(IIcon) DropInterface((struct Interface *)IIcon);
+#endif
+       CloseLibrary(IconBase);
 
 /*
        if(IDOS)
@@ -44,11 +41,14 @@
        CONST_STRPTR *toolarray;
        char *s;
 
-       if((*wbarg->wa_Name) && (dobj=IIcon->GetIconTags(wbarg->wa_Name,NULL)))
+       force8bit = 0;
+       swapmousebuttons = 0;
+
+       if((*wbarg->wa_Name) && (dobj=GetDiskObject(wbarg->wa_Name)))
        {
                toolarray = (CONST_STRPTR *)dobj->do_ToolTypes;
 
-               if(s = (char *)IIcon->FindToolType(toolarray,"ROM"))
+               if(s = (char *)FindToolType(toolarray,"ROM"))
                {
                char *sNewRomName = strdup(s);
         
@@ -63,7 +63,7 @@
         }
 
 #if defined(EXTNROM_SUPPORT)
-               if(s = (char *)IIcon->FindToolType(toolarray,"EXTNROMDIR"))
+               if(s = (char *)FindToolType(toolarray,"EXTNROMDIR"))
                {
                char *sNewExtnRomDir = strdup(s);
 
@@ -78,7 +78,7 @@
 
 #endif /* EXTNROM_SUPPORT */
 #if defined(HOSTFS_SUPPORT)
-               if(s = (char *)IIcon->FindToolType(toolarray,"HOSTFSDIR"))
+               if(s = (char *)FindToolType(toolarray,"HOSTFSDIR"))
                {
                char *sNewHostFSDir = strdup(s);
         
@@ -93,55 +93,76 @@
         }
 #endif /* HOSTFS_SUPPORT */
 
-               if(s = (char *)IIcon->FindToolType(toolarray,"MEMORY"))
+               if(s = (char *)FindToolType(toolarray,"MEMORY"))
                {
-                       if(IIcon->MatchToolValue(s,"256K"))
+                       if(MatchToolValue(s,"256K"))
                        hArcemConfig.eMemSize = MemSize_256K;
 
-                       if(IIcon->MatchToolValue(s,"512K"))
+                       if(MatchToolValue(s,"512K"))
                        hArcemConfig.eMemSize = MemSize_512K;
 
-                       if(IIcon->MatchToolValue(s,"1M"))
+                       if(MatchToolValue(s,"1M"))
                        hArcemConfig.eMemSize = MemSize_1M;
 
-                       if(IIcon->MatchToolValue(s,"2M"))
+                       if(MatchToolValue(s,"2M"))
                        hArcemConfig.eMemSize = MemSize_2M;
 
-                       if(IIcon->MatchToolValue(s,"4M"))
+                       if(MatchToolValue(s,"4M"))
                        hArcemConfig.eMemSize = MemSize_4M;
 
-                       if(IIcon->MatchToolValue(s,"8M"))
+                       if(MatchToolValue(s,"8M"))
                        hArcemConfig.eMemSize = MemSize_8M;
 
-                       if(IIcon->MatchToolValue(s,"12M"))
+                       if(MatchToolValue(s,"12M"))
                        hArcemConfig.eMemSize = MemSize_12M;
 
-                       if(IIcon->MatchToolValue(s,"16M"))
+                       if(MatchToolValue(s,"16M"))
                        hArcemConfig.eMemSize = MemSize_16M;
-
       }
 
-               if(s = (char *)IIcon->FindToolType(toolarray,"PROCESSOR"))
+               if(s = (char *)FindToolType(toolarray,"PROCESSOR"))
                {
-                       if(IIcon->MatchToolValue(s,"ARM2"))
+                       if(MatchToolValue(s,"ARM2"))
                         hArcemConfig.eProcessor = Processor_ARM2;
 
-                       if(IIcon->MatchToolValue(s,"ARM250"))
+                       if(MatchToolValue(s,"ARM250"))
                         hArcemConfig.eProcessor = Processor_ARM250;
 
-                       if(IIcon->MatchToolValue(s,"ARM3"))
+                       if(MatchToolValue(s,"ARM3"))
                         hArcemConfig.eProcessor = Processor_ARM3;
 
                }
 
-               if(IIcon->FindToolType(toolarray,"FORCE8BIT")) force8bit=1;
+               if(FindToolType(toolarray,"FORCE8BIT")) force8bit=1;
+
+               if(FindToolType(toolarray,"SWAPBUTTONS")) swapmousebuttons=1;
+
+               if(FindToolType(toolarray, "USEUPDATEFLAGS"))
+                       DisplayDev_UseUpdateFlags = 1;
+
+               if(s = (char *)FindToolType(toolarray, "FRAMESKIP"))
+                       DisplayDev_FrameSkip = atoi(s);
+               else DisplayDev_FrameSkip = 0;
+
+               if(FindToolType(toolarray, "AUTOUPDATEFLAGS"))
+                       DisplayDev_AutoUpdateFlags = 1;
+
+               if(FindToolType(toolarray, "NOCONSOLEOUTPUT"))
+               {
+                       /* if we are launching from WB, we don't need console 
windows popping up */
+                       fclose(stderr);
+                       stderr = fopen("NIL:","w");
+
+                       fclose(stdout);
+                       stdout = fopen("NIL:","w");
+               }
 
                /* This code implements ReadConfig.c via tooltypes - it 
searches for
                        ST506DISC, but it will only support 1 line atm.
                        It is literally a copy'n'paste of the other code with 
fscanf(fConf)
                        changed to sscanf(s) */
 
-                       if(s = (char 
*)IIcon->FindToolType(toolarray,"ST506DISC"))
+                       if(s = (char *)FindToolType(toolarray,"ST506DISC"))
                        {
                        unsigned int drivenum,numcyl,numheads,numsect,reclength;
                        if (sscanf(s,"%u %u %u %u 
%u\n",&drivenum,&numcyl,&numheads,&numsect,&reclength)!=5)
@@ -163,7 +184,7 @@
         }
 
 
-               IIcon->FreeDiskObject(dobj);
+               FreeDiskObject(dobj);
        }
 
 }
@@ -174,11 +195,15 @@
        long i;
        int olddir;
 
+       #ifdef __amigaos4__
     IExec = (struct ExecIFace *)(*(struct ExecBase **)4)->MainInterface;
-
-       if(IconBase = IExec->OpenLibrary("icon.library",51))
+       #endif
+       
+       if(IconBase = OpenLibrary("icon.library",37))
        {
-               IIcon = IExec->GetInterface(IconBase,"main",1,NULL);
+       #ifdef __amigaos4__
+               IIcon = GetInterface(IconBase,"main",1,NULL);
+       #endif
        }
        else
        {
@@ -186,9 +211,11 @@
                return;
        }
 
-       if(DOSBase = IExec->OpenLibrary("dos.library",51))
+       if(DOSBase = OpenLibrary("dos.library",37))
        {
-               IDOS = IExec->GetInterface(DOSBase,"main",1,NULL);
+       #ifdef __amigaos4__
+               IDOS = GetInterface(DOSBase,"main",1,NULL);
+       #endif
        }
        else
        {
@@ -196,22 +223,15 @@
                return;
        }
 
-       /* if we are launching from WB, we don't need console windows popping 
up */
-               fclose(stderr);
-               stderr = fopen("NIL:","w");
-
-               fclose(stdout);
-               stdout = fopen("NIL:","w");
-
        for(i=0,wbarg=WBenchMsg->sm_ArgList;i<WBenchMsg->sm_NumArgs;i++,wbarg++)
        {
                olddir =-1;
                if((wbarg->wa_Lock)&&(*wbarg->wa_Name))
-                       olddir = IDOS->CurrentDir(wbarg->wa_Lock);
+                       olddir = CurrentDir(wbarg->wa_Lock);
 
                gettooltypes(wbarg);
 
-               if(olddir !=-1) IDOS->CurrentDir(olddir);
+               if(olddir !=-1) CurrentDir(olddir);
        }
 
        closewblibs();

Index: ArcEm.guide
===================================================================
RCS file: /cvsroot/arcem/arcem/amiga/ArcEm.guide,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ArcEm.guide 25 Apr 2008 20:41:35 -0000      1.7
+++ ArcEm.guide 12 May 2012 17:34:51 -0000      1.8
@@ -36,6 +36,10 @@
 Additionally, there is a tooltype ST506DISC which allows you to specify one 
".arcemrc" config line.
 
 FORCE8BIT: Force ArcEm to only open 8-bit screens.  This potentially avoids 
some screen closing/opening and monitor resyncing, but may use more memory or 
be slower especially on planar configurations.
+
+SWAPMOUSEBUTTONS: Swaps MMB and RMB, most useful to allow two button mice to 
get into RISC OS menus.
+
+NOCONSOLEOUTPUT: Stops console output.
 @endnode
 
 @node ARexx


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
-- 
arcem-cvs mailing list
arcem-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/arcem-cvs

Reply via email to