Skip to content

Commit

Permalink
intellimouse scroll wheel support and driver added.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrajnc committed Jun 21, 2014
1 parent fd94eab commit d5b6374
Show file tree
Hide file tree
Showing 24 changed files with 1,611 additions and 200 deletions.
12 changes: 12 additions & 0 deletions amiga_sw/WheelDriver/Build68k
@@ -0,0 +1,12 @@
stack 50000
Echo "Building project - this may take a while!"
Echo " "
CompList >t:BScr vc +68k -+ -c %s -o 68kobj/%s%s
execute t:BScr
Echo " "
Echo "Linking..."
vc +68k -o WheelDriver 68kobj/#?.o
delete >nil: t:BScr
Echo " "
Echo "All done."

Binary file added amiga_sw/WheelDriver/CompList
Binary file not shown.
89 changes: 89 additions & 0 deletions amiga_sw/WheelDriver/CompList.c
@@ -0,0 +1,89 @@
/*******************************************************************************
CompList V1.0 - Written by Alastair M. Robinson in 1998.
Tiny little shell utility to create a compilation script for VBCC according
to those files which have the archive bit cleared.
The script is sent to StdOut, normally to be redirected to a file in t:
When executed, the script will compile the appropriate files, and if
successful, set their archive bit so they'll be skipped in future until
they're saved again! Useful for machines which have no battery-backed clock,
and hence can't use the traditional Make tools.
CompList >t:BuildScript vc -c %s -o Obj/%s%s
Execute t:BuildScript
will call vc for all files which have changed since the last build, placing
the resulting object files in the Obj directory.
Link them together with something like
join Obj/(#?.o|#?.lib) to Prog.o
PhxLnk vlib:Startup.o vlib:vc.lib vlib:amiga.lib Prog.o to a.out
Compiled with the totally brilliant VBCC.
vc CompList.c -o CompList
Public Domain
*******************************************************************************/

#include <stdio.h>

#include <utility/tagitem.h>
#include <dos/dos.h>

#include <clib/dos_protos.h>
#include <clib/exec_protos.h>

void halt() = "\tillegal\n";

int main()
{
LONG *Args[]={0,0};
BOOL result=FALSE;
struct RDArgs* rd;
char pattern[]="(#?.c|#?.s)";
struct FileInfoBlock* fib=0;
BPTR lock;
char tokenstring[130];
char *namebuffer;

if (rd=ReadArgs("VCOPTIONS/F/A",(LONG *)&Args[0],NULL))
{
if (fib = AllocDosObjectTags(DOS_FIB,TAG_DONE))
{
if (ParsePatternNoCase(pattern,tokenstring,128) != -1);
{
if (lock=Lock("",ACCESS_READ))
{
if (Examine(lock,fib))
{
do
{
if(!(fib->fib_Protection & FIBF_ARCHIVE) && (fib->fib_DirEntryType)<0 && MatchPatternNoCase(tokenstring,fib->fib_FileName))
{
if(namebuffer=(char *)malloc(strlen(fib->fib_FileName)+2))
{
strcpy(namebuffer,fib->fib_FileName);
namebuffer[strlen(namebuffer)-2]=0;
printf("Echo \"Compiling %s.....\"\n",fib->fib_FileName);
printf((char *)Args[0],fib->fib_FileName,namebuffer,".o");
printf("\n");
printf("if not warn\nprotect %s +a\nendif\n",(fib->fib_FileName));
free(namebuffer); namebuffer=NULL;
}
}
} while(ExNext(lock,fib));
result=TRUE;
}
UnLock(lock);
}
}
FreeDosObject(DOS_FIB,fib);
}
FreeArgs(rd);
}
if(result=FALSE)
PrintFault(IoErr(),"Error");
return(0);
}

180 changes: 180 additions & 0 deletions amiga_sw/WheelDriver/Cx.c
@@ -0,0 +1,180 @@
#include <stdio.h>
#include <stdlib.h>

#include <exec/types.h>
#include <exec/ports.h>
#include <exec/memory.h>
#include <libraries/commodities.h>
#include <clib/exec_protos.h>
#include <clib/commodities_protos.h>
#include <clib/alib_protos.h>

#include "Cx.h"

BOOL HandleCxMessages(struct CxContext *cx,unsigned long signals);
void DisposeCxContext(struct CxContext *cx);
BOOL Cx_SetHotKey(struct CxContext *cx,char *hotkey);
BOOL Cx_SetCustomRoutine(struct CxContext *cx,void (*rout)(CxMsg *msg,CxObj *obj));


BOOL Cx_SetHotKey(struct CxContext *cx,char *hotkey)
{
if(cx->HotKey)
DeleteCxObjAll(cx->HotKey);
if(cx->HotKey=HotKey(hotkey,cx->Port,CXCMD_APPEAR))
AttachCxObj(cx->Broker,cx->HotKey);
if(cx->HotKey)
return(TRUE);
else
return(FALSE);
}


BOOL Cx_SetCustomRoutine(struct CxContext *cx,void (*rout)(CxMsg *msg,CxObj *obj))
{
if(cx->CustomObject)
DeleteCxObjAll(cx->CustomObject);
if(cx->CustomObject=CxCustom(rout,0))
AttachCxObj(cx->Broker,cx->CustomObject);
if(cx->CustomObject)
return(TRUE);
else
return(FALSE);
}


BOOL HandleCxMessages(struct CxContext *cx,unsigned long signals)
{
struct Message *msg;
long id;
BOOL result=TRUE;
if(cx)
{
if(signals&cx->Signals)
{
while(msg=GetMsg(cx->Port))
{
id=CxMsgID((CxMsg *)msg);
ReplyMsg(msg);
switch(id)
{
case CXCMD_DISABLE:
if(cx->DisableCallback)
{
cx->DisableCallback(cx->UserData);
}
else
{
if(cx->CustomObject)
ActivateCxObj(cx->CustomObject,FALSE);
}
break;
case CXCMD_ENABLE:
if(cx->EnableCallback)
{
cx->EnableCallback(cx->UserData);
}
else
{
if(cx->CustomObject)
ActivateCxObj(cx->CustomObject,TRUE);
}
break;
case CXCMD_UNIQUE:
case CXCMD_APPEAR:
if(cx->ShowCallback)
cx->ShowCallback(cx->UserData);
break;
case CXCMD_DISAPPEAR:
if(cx->HideCallback)
cx->HideCallback(cx->UserData);
break;
case CXCMD_KILL:
result=FALSE;
break;
}
}
}
}
return(result);
}


struct CxContext *CxContext_Create(char *name,char *title,char *descr)
{
struct CxContext *cx;
char *hotkeystring;
CxObj *hotkeyobj;

struct NewBroker MyNewBroker =
{
NB_VERSION,
NULL,
NULL,
NULL,
NBU_UNIQUE|NBU_NOTIFY,
0,
0,
NULL
};

MyNewBroker.nb_Name=name;
MyNewBroker.nb_Title=title;
MyNewBroker.nb_Descr=descr;

if(!(cx=malloc(sizeof(struct CxContext))))
return(NULL);
memset(cx,0,sizeof(struct CxContext));

cx->Dispose=DisposeCxContext;
cx->Handle=HandleCxMessages;
cx->SetHotKey=Cx_SetHotKey;
cx->SetCustom=Cx_SetCustomRoutine;

cx->HotKey=NULL;
cx->CustomObject=NULL;

cx->UserData=NULL;
cx->EnableCallback=NULL;
cx->DisableCallback=NULL;
cx->ShowCallback=NULL;
cx->HideCallback=NULL;

if(!(cx->Port=CreateMsgPort()))
{
cx->Dispose(cx);
return(NULL);
}
cx->Signals=(1<<cx->Port->mp_SigBit);
MyNewBroker.nb_Port=cx->Port;

if(!(cx->Broker=CxBroker(&MyNewBroker,NULL)))
{
cx->Dispose(cx);
return(NULL);
}

ActivateCxObj(cx->Broker,TRUE);

return(cx);
}


void DisposeCxContext(struct CxContext *cx)
{
if(cx)
{
if(cx->Broker)
{
DeleteCxObjAll(cx->Broker);
cx->Broker=NULL;
}
if(cx->Port)
{
DeleteMsgPort(cx->Port);
cx->Port=NULL;
}
free(cx);
}
}

26 changes: 26 additions & 0 deletions amiga_sw/WheelDriver/Cx.h
@@ -0,0 +1,26 @@
#ifndef CXCONTEXT_H
#define CXCONTEXT_H

#include <libraries/commodities.h>

struct CxContext
{
void (*Dispose)(struct CxContext *cx);
BOOL (*Handle)(struct CxContext *cx,unsigned long signals);
BOOL (*SetHotKey)(struct CxContext *cx,char *hotkey);
BOOL (*SetCustom)(struct CxContext *cx,void (*rout)(CxMsg *msg,CxObj *obj));
void (*ShowCallback)(void *userdata);
void (*HideCallback)(void *userdata);
void (*EnableCallback)(void *userdata);
void (*DisableCallback)(void *userdata);
void *UserData; /* Useful from within Callback functions */
struct MsgPort *Port;
void *Broker;
void *CustomObject;
void *HotKey;
unsigned long Signals;
};

struct CxContext *CxContext_Create(char *name,char *title,char *descr);

#endif

0 comments on commit d5b6374

Please sign in to comment.