EVPlugBase Program Guide



Version 1.1 beta 1
12/18/1999
Copyright by EVSoft Co., Ltd.
All rights reserved.

CONTENTS:

  1. Overview
  2. How to write a Plugin?
  3. FAQ


Overview

EVPlugBase is an open platform for third-party developers to develop a Plugin for Palm OS. Plam OS is very succinct os system, but it's a little inconvenient. Many programers develop patchs for the system, some of them are based with Hack Master, a great platform for patchs, others are not. That was the internal reason that might crash the pilot.

After we finished EVEdit, a Hack extension, we find it is necessary to develop a new mechanism to the programers who want add some of the system patch trap in their applications. We name these applications "Plugin", different with "hack".

What is lack of the Hack Master?

  1. Not solve the hack conflict with the no-hack application problem.
  2. Strictly resources requirement:
  3. Waste of code, for example, when a patch want to replace several system trap, normally a piece of init code needed in sereral place, that will waste a lot code.
  4. Inflexible programing, for example, in different versioin of OS, SysKeyboardDialog trap is different, if you want to replace it in Palm OS 1.0, you must replace the SysKeyboardDialogV10 trap, but when you try in Palm OS 2.0, you must replace SysKeyboardDialog trap, so you must provide two version for these two OS.

When we developing EVEdit (A HackMaster extention), we feel these inconvenient deeply, so we develop EVPlugBase, to manage Plugins for Palm OS. The enhancement list below:

  1. EVPlugBase can manage all Plugin written according EVPlugBase rule. No conflict each other.
  2. EVPlugBase can manage all other no-hack applications that replace system traps.
  3. Provide delete-protection. This prevent some users to delete Plugin or HackExtention which is actived, that will mostly cased a system crash.
  4. Provide SoftPenStroke function for Plugin. It will save many time of patch programer.
  5. Solve all problem that list in the lack of Hack Master.


How to write a Plugin?

  1. Mechanism introduction
  2. Resources requirement
  3. EVPlugBase Launch Command
  4. EVPlugBase API


Mechanism introduction
EVPlugBase supports four kind of patchs,

  1. Hack extentions written according to Hack Master rules.
  2. Passive plugins written according to EVPlugBase rules.
  3. Active plugins written according to EVPlugBase rules.
  4. Others applications written not according to Hack Master rules nor EVPlugBase rules.

As far as the patchs, it is the applications that include a piece of replacement code of SysTrap.
EVPlugBase notify plugin with 'Launch Command' to load or unload etc. Plugin act by those commands.

Resources requirement
The resources requirement of a plugin in EVPlugBase is almost same as one general application.

Resource of big icon is    'tAIB', ID 1000
Resource of small icon is  'tAIB', ID 1001
Resource of plugin name is 'tAIN', ID 1000
These are same as general applications.

As far as the passive plugins, their type must be 'PLUG'.
As far as the active plugins, there is no limitation. Active plugins are actual general applications which call EVPlugBase internal functions.

EVPlugBase Launch Command
As metioned before, EVPlugBase communicates with plugins with Launch Command. Here list the Commands.

PBLaunchCmd_GetInformation
PBLaunchCmd_PluginAttach
PBLaunchCmd_PluginDetach
PBLaunchCmd_ActivePluginInfoPanel
PBLaunchCmd_ActivePluginControlPanel
PBLaunchCmd_SoftPenStroke

//------------------------------------------------------------------------
// Parameter blocks for action code
//------------------------------------------------------------------------

typedef struct {
   ULong    id;                       // Launch command identifier for EVPlugBase,
                                            // seted to PlugBaseCreator['evPM']
                                            // by EVPlugBase before launch
   ULong    pluginType;         // Type of plugin PRC
   ULong    pluginCreator;     // Creator of plugin PRC
   PlugBaseAPIPtr apiP;        // EVPlugBaseAPI pointer
   Err         err;

   union param {
       struct allParam {
           Word data[8];
       } allParam;

       // For PBLaunchCmd_GetInformation
       struct {
           Boolean  supportInfoPanel;
           Boolean  supportConfigPanel;
       } getInformation;

       // For PBLaunchCmd_SoftPenStroke
       struct {
           UInt  id;
       } SoftPenStroke;

   } data;
} PBLaunchParameterType, *PBLaunchParameterPtr;
 

EVPlugBase API
EVPlugBase provide a suit of API to replace SysTrap or to install SoftPenStroke.

FAQ

Question: Could I operate with the pointer returned from SysGetTrapAddress, for example, lock, unlock etc?
Answer: No all. The pointer from SysGetTrapAddress could only be used to save or be released by SysSetTrapAddress, can't be operated by other ways. LaunchIII might operate the pointer and cause a crash when uncheck the box Always use LaunchIII.

Question: Can I write a application to replace a SysTrap not according the EVPlugBase?
Answer:Yes, you can. Because EVPlugBase rewrite the SysGetTrapAddress and SysSetTrapAddress two function. We suggest you write as the general ways:

static void hookASysTrap ()
{
       UInt        trapNum = sysTrapXXXX;
       VoidPtr   oldTrapAddr;

       oldTrapAddr = SysGetTrapAddress (trapNum);
       //A way to save old address
       //appCreator the creator of application
       FtrSet (appCreator, trapNum, (DWord) oldTrapAddr);
       SysSetTrapAddress (trapNum, sysTrapXXXXnewProc);
}

static void unhookASysTrap ()
{
       UInt        trapNum = sysTrapXXXX;
       VoidPtr   oldTrapAddr;

       if (FtrGet (appCreator, trapNum, (DWordPtr)(&oldTrapAddr)) == 0)
       {
               SysSetTrapAddress (trapNum, oldTrapAddr);
               FtrUnregister (appCreator, trapNum);
       }
}


Question: When more than one application replace one SysTrap, what must be noticed?
Answer: Because EVPlugBase rewrite SysGetTrapAddress and SysSetTrapAddress two function, the SysTrap can be replaced more than one times, and can be released without the First in, First out order. You just need to replace or release the SysTrap, and save the old address as the last question&answer metioned.

Question: Can one SysTrap be replaced more than once in a application?
Answer: In Plugin, a Systrap can only be replaced one times, can not be replaced more than one times. If the application not apply the EVPlugbase rule, direct call SysGetTrapAddress and SysSetTrapAddress to replace SysTrap, and can save every old Systrap address safely, it can replace the address sereral times. But these replacement is meanless.

Question: Can I run hacks in EVPlugBase?
Answer:   Yes.

Question: Can I run Plugins in Hack Master?
Answer:   No if the plugin written according rule of EVPlugBase.

Question: My pilot crash and reset when I uncheck the box of Always use LauncherIII after I installed EVPlugBase, how to solve the problem?
Answer:   Please disable EVPlugbase first, then uncheck the box of Always use LauncherIII, then enable EVPlugbase.

Question: Can EVPlugBase manage no-hack applications or non-EVPlugBase applications?
Answer:   Yes.