Welcome, Guest. Please login or register.

Author Topic: Which No Click Program?  (Read 8901 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Which No Click Program?
« on: August 21, 2008, 12:04:24 PM »
These programs toggle one bit in the trackdisk.device unit structure (per drive). The unit structure and the bit are described in the devices/trackdisk.h include.

There is no patching or separate task/process needed. You can't get this wrong.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Which No Click Program?
« Reply #1 on: August 21, 2008, 04:10:23 PM »
There's nothing hacky about it. The "noclick" functionality it provided by the OS itself, these programs just enable it. Observe:

Code: [Select]
;/*
sc resopt link optimize optsched nodebug strmerge nostartup nostackcheck data=far noclick.c
quit
*/

#include <devices/trackdisk.h>
#include <dos/dos.h>
#include <proto/exec.h>

static void setnoclick(ULONG unitnum, ULONG onoff);

int main(void)
{
  int unit;
  for (unit = 0; unit < NUMUNITS; unit++)
  {
    setnoclick(unit, 1);
  }
  return RETURN_OK;
}

static void setnoclick(ULONG unitnum, ULONG onoff)
{
  struct MsgPort *port;
  port = CreateMsgPort();
  if (port)
  {
    struct IOStdReq *ioreq;
    ioreq = CreateIORequest(port, sizeof(*ioreq));
    if (ioreq)
    {
      if (OpenDevice(TD_NAME, unitnum, (APTR) ioreq, 0) == 0)
      {
        struct TDU_PublicUnit *unit = (APTR) ioreq->io_Unit;
        Forbid();
        if (onoff)
          unit->tdu_PubFlags |= TDPF_NOCLICK;
        else
          unit->tdu_PubFlags &= ~TDPF_NOCLICK;
        Permit();
        CloseDevice((APTR) ioreq);
      }
      DeleteIORequest((APTR) ioreq);
    }
    DeleteMsgPort(port);
  }
}
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Which No Click Program?
« Reply #2 on: August 22, 2008, 02:26:45 PM »
noclick ... 136 ----rwed Tänään     16:25:35


Didn't even try much. It could be even smaller...
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Which No Click Program?
« Reply #3 on: August 24, 2008, 06:08:10 PM »
Code: [Select]
noclick2                           152 ----rwed Tänään    20:41:42
With WBStartup support, 100% OS friendly.

:-D