Welcome, Guest. Please login or register.

Author Topic: Can someone do some editing on a small tool written in C?  (Read 3672 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline FlashlabTopic starter

  • Hero Member
  • *****
  • Join Date: Aug 2005
  • Posts: 1396
    • Show only replies by Flashlab
Can someone do some editing on a small tool written in C?
« on: June 15, 2007, 09:09:26 PM »
There's a small tool on Aminet called Doubler that makes the right mouse button work with ShapeShifter. It makes the right mouse button do a double click hence the name. I'd like it to be edited to do a Right-Amiga plus single left mouse click. That would give the Mac essentially a right mouse button.

Doubler: it comes with source code. I don't know anything about C but I guess it's not a too difficult program to edit for a amateur coder.

Is there anyone who would like to do try this? I'd appreciate it very much!
Amiga 4000D Cyberstorm PPC 060@50 604@200 SCSI 130Mb Ram G-Rex Voodoo3 PicassoIV Paloma Ariadne Delfina Lite

Online Flash version of BoulderDash: Offline...
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Can someone some editing on a small tool written in C?
« Reply #1 on: June 15, 2007, 09:10:52 PM »
Piru? :-P

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline FlashlabTopic starter

  • Hero Member
  • *****
  • Join Date: Aug 2005
  • Posts: 1396
    • Show only replies by Flashlab
Re: Can someone some editing on a small tool written in C?
« Reply #2 on: June 15, 2007, 09:14:56 PM »
He already did so much for us. He deserves his weekend rest!

I guess it's time I should learn to code myself. I can only do some Flash actionscript and basic...
Amiga 4000D Cyberstorm PPC 060@50 604@200 SCSI 130Mb Ram G-Rex Voodoo3 PicassoIV Paloma Ariadne Delfina Lite

Online Flash version of BoulderDash: Offline...
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Can someone some editing on a small tool written in C?
« Reply #3 on: June 15, 2007, 09:37:42 PM »
Quote
Flashlab wrote:
He already did so much for us. He deserves his weekend rest!

True :-)

Quote
Flashlab wrote:
I guess it's time I should learn to code myself. I can only do some Flash actionscript and basic...

C is really not that difficult in terms of syntax. It's really quite readable. The problem will be finding out which AmigaOS function you need to call (and how) to emulate the pressing of the Amiga key and the left mouse button.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show only replies by Karlos
Re: Can someone some editing on a small tool written in C?
« Reply #4 on: June 15, 2007, 09:50:49 PM »
It looks like this is the place to make the change:

Code: [Select]

/*F*/static VOID doubleclick(GD gd)
{
   UWORD qualifier;
   WORD x, y;

   /* get values from input-handler under protection */
   Forbid();
   qualifier = gd->gd_Event.ie_Qualifier;
   x = gd->gd_Event.ie_X;
   y = gd->gd_Event.ie_Y;
   Permit();

   /* the first click */
   writemouseevent(gd, IECODE_LBUTTON, qualifier, x, y);
   writemouseevent(gd, IECODE_LBUTTON | IECODE_UP_PREFIX, qualifier, x, y);
   /* wait some time */
   Delay(gd->gd_Speed);
   /* and the first click */
   writemouseevent(gd, IECODE_LBUTTON, qualifier, x, y);
   writemouseevent(gd, IECODE_LBUTTON | IECODE_UP_PREFIX, qualifier, x, y);
}


It would be quite a hack but you might simply get away with removing the second click and injecting the desired qualifier keycode in "qualifier" like so:
Code: [Select]

qualifier = gd->gd_Event.ie_Qualifier | IEQUALIFIER_RCOMMAND;

Of course you'd need to change IECODE_LBUTTON to IECODE_RBUTTON too ;-)

Alas I don't currently have shapeshifter nor the time to mess about with it.

-edit-

This is pretty hacky, since you are setting the state of a InputEvent.ie_Qualifier that was never really set by a key down, so there could be some weirdness.

A cleaner way would be to inject an InputEvent for pressing the key, then the right mouse press, then the right mouse release and finally the key release.

That said, I think you'd get away with it on the grounds that applications often don't internally track such changes since each InputEvent generally comes complete with all the current qualifier keys in ie_Qualifier principally so you don't have to track them ;-)
int p; // A
 

Offline FlashlabTopic starter

  • Hero Member
  • *****
  • Join Date: Aug 2005
  • Posts: 1396
    • Show only replies by Flashlab
Re: Can someone some editing on a small tool written in C?
« Reply #5 on: June 15, 2007, 09:51:41 PM »

Quote

C is really not that difficult in terms of syntax. It's really quite readable. The problem will be finding out which AmigaOS function you need to call (and how) to emulate the pressing of the Amiga key and the left mouse button.

--
moto


I already read the code. It seems quite readable; that's true but compiling seems like a disaster to me. Some months ago I did some small experiments and nothing but trouble;-) I just tried to compile this program but that didn't work out for me. Not to mention I don't know any of the commands.
Amiga 4000D Cyberstorm PPC 060@50 604@200 SCSI 130Mb Ram G-Rex Voodoo3 PicassoIV Paloma Ariadne Delfina Lite

Online Flash version of BoulderDash: Offline...
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Can someone some editing on a small tool written in C?
« Reply #6 on: June 15, 2007, 09:52:54 PM »
omigod karlos j00 is teh 1337++!!!!1

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Can someone some editing on a small tool written in C?
« Reply #7 on: June 15, 2007, 09:53:56 PM »
@Flashlab
Ahhh yes, I find compiling a nightmare too :-(

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline uncharted

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 1520
    • Show only replies by uncharted
Re: Can someone some editing on a small tool written in C?
« Reply #8 on: June 15, 2007, 09:56:04 PM »
Karlos! Karlos Kebab Van!
If he can't do it, no-one can!

 

Offline FlashlabTopic starter

  • Hero Member
  • *****
  • Join Date: Aug 2005
  • Posts: 1396
    • Show only replies by Flashlab
Re: Can someone some editing on a small tool written in C?
« Reply #9 on: June 15, 2007, 09:58:20 PM »
The problem with compiling was that I just kept getting errors. Whenever I fixed one I just got a new one ;-) Haha! In the end I just gave up.

This weekend I'll try do it again...
Amiga 4000D Cyberstorm PPC 060@50 604@200 SCSI 130Mb Ram G-Rex Voodoo3 PicassoIV Paloma Ariadne Delfina Lite

Online Flash version of BoulderDash: Offline...
 

Offline FlashlabTopic starter

  • Hero Member
  • *****
  • Join Date: Aug 2005
  • Posts: 1396
    • Show only replies by Flashlab
Re: Can someone some editing on a small tool written in C?
« Reply #10 on: June 15, 2007, 10:03:09 PM »
You don't need ShapeShifter to test this program. It has a debug Tooltype to test and can work with any task also by Tooltype.
Amiga 4000D Cyberstorm PPC 060@50 604@200 SCSI 130Mb Ram G-Rex Voodoo3 PicassoIV Paloma Ariadne Delfina Lite

Online Flash version of BoulderDash: Offline...
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show only replies by Karlos
Re: Can someone some editing on a small tool written in C?
« Reply #11 on: June 15, 2007, 10:11:36 PM »
I might have a look tomorrow then. After the week I've had, if I have to write another line of code in any language, I'll go mad :lol:
int p; // A
 

Offline FlashlabTopic starter

  • Hero Member
  • *****
  • Join Date: Aug 2005
  • Posts: 1396
    • Show only replies by Flashlab
Re: Can someone some editing on a small tool written in C?
« Reply #12 on: June 15, 2007, 10:18:27 PM »
Haha tough week eh? Some here but not with any coding;-)
Amiga 4000D Cyberstorm PPC 060@50 604@200 SCSI 130Mb Ram G-Rex Voodoo3 PicassoIV Paloma Ariadne Delfina Lite

Online Flash version of BoulderDash: Offline...
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Can someone some editing on a small tool written in C?
« Reply #13 on: June 15, 2007, 10:18:28 PM »
Go on do it, write one more line. I want to see what happens.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline FlashlabTopic starter

  • Hero Member
  • *****
  • Join Date: Aug 2005
  • Posts: 1396
    • Show only replies by Flashlab
Re: Can someone some editing on a small tool written in C?
« Reply #14 on: June 15, 2007, 10:57:20 PM »
I re-read you post Karlos and maybe I'm mistaken but I think you got some things mixed up?

The program looks for right mous button clicks within a specific task name (default: ShapeShifter Window Int; can be changed with ToolType). If the right mouse button is clicked it simulates a double click with the left mouse button. I want it to simulate instead a single left click with right Amiga pressed simultaneously.

Correct me if I'm wrong but then you don't need to replace IECODE_LBUTTON with IECODE_RBUTTON or do a InputEvent because it doesn't need to check key strokes?
Amiga 4000D Cyberstorm PPC 060@50 604@200 SCSI 130Mb Ram G-Rex Voodoo3 PicassoIV Paloma Ariadne Delfina Lite

Online Flash version of BoulderDash: Offline...