Delphi SDK: Plugin's for OfflineList.

If you have some comments or if you want more function please contact me at Replouf66@Hotmail.com

If you make a plugin for OfflineList please contact me, I will test it and propose it on my web site.
Replouf66@Hotmail.com

Before start:

Declaration needed:

type FSetSize = procedure(rom: PPChar; size:pInteger; newSize: Integer); stdcall; // this procedure is called to allocate memory for the rom.
     rom is a Pointer to a PCHAR, it will contain the rom.
     size indicate the current size of the rom.
     newSize indicate the new size to allocate for the PPChar.
     In this function, you need to do that: ReallocMem(rom^, newSize); size^ := newSize;

type FPGetRom = procedure(rom: PPChar; size: pInteger; crc: pchar; patch:Integer; resize:FSetSize); stdcall; // you can call this procedure to get rom.
     rom : is a Pointer to a PCHAR, it will contain the rom.
     size : will indicate the size of rom.
     crc : indicate the CRC32 of the rom wanted.
     patch : indicate if the rom will be patched by the module. Use 0 for patch the rom, and for futher evolution use -1 if you don't want patch the rom.
     resize : indicate the address of your procedure FSetSize.

type FPLaunchEmulatorFile = procedure(f:pchar); stdcall; // you can call this function to launch the emulator.
f : indicate the complete path of the rom (zipped or not). Ex: 'C:\dir\rom.zip' type FPLaunchEmulatorCRC = procedure(crc:PCHAR); stdcall; // you can call this function to launch the emulator. crc : indicate the crc of the rom you want play with the emulator. type
FPAddRoms = procedure(roms:PCHAR); // this function permit you to add roms by indicating the path of the roms. roms is a PCHAR who contains one or more roms (zipped or not). You need to concat all the path of all roms add finish the PCHAR by #0#0. Exemple: - for one rom: roms := 'C:\dir\foo.zip'+#0 + #0; - for more than one rom: roms := 'C:\dir\foo.zip'+#0 + 'D:\dir\foo2.gba'+#0 + ... + 'D:\dir\foox.gba'+#0 + #0;
SDK version "0.4" :
type
   PGame = ^TGame; // a pointer to a TGame.
   TGame=record // this record indicate some information about the rom.
      nextGame: PGame; // the next game selected.
      crc: PChar; // indicate the crc of the rom file.
      name: PChar; // indicate the name of the game.
      named: PChar; // indicate the rom naming.
      num: Integer; // indicate the release number of the rom.
      size: Integer; // indicate the size of the rom.
      location: Integer; // indicate the location of the rom.
           0 : Europe
           1 : USA
           2 : Germany
           3 : China
           4 : Spain
           5 : France
           6 : Italy
           7 : Japan
           8 : Nederland
      language: Integer; // indicate the Language(s) of the rom.
           1     : French
2 : English
4 : Chinese
8 : Danish
16 : Dutch
32 : Finland
64 : German
128 : Italian
256 : Japanese
512 : Norwegian
1024 : Polish
2048 : Portuguese
4096 : Spanish
8192 : Swedish
16384 : English // if there are 2 english language in the game (like Harry potter), this one is the UK version
32768 : Portuguese // if there are 2 Portuguese language in the game (like Harry potter), this one is the BR version Exemple of use:
- if (game.language and 256) <> 0 then the Danish language is in the game.
save: PChar; // indicate the save type of the rom. publisher: PChar; // this is the publisher of the game. sourceRom: PChar; // this is the group who release the first dump available for the rom. comment: PChar; // this is the comment available for this rom. end;
type
   TFunction=record
      getRom: FPGetRom; // call this procedure to receive a rom.
      launchEmulatorFile: FPLaunchEmulatorFile; // call this procedure to launch the emulator on a spécified file.
launchEmulatorCRC: FPLaunchEmulatorCRC; // call this procedure to launch the emulator on the game who have the specified CRC. addRoms: FPAddRoms; // with this function you can add roms to OfflineList. end;

Old sdk version : 0.1 0.2 0.3



Function/Procedure Summary
procedure closePlugin; stdcall;
          This procedure is called when the plugin is deactivated.
function

getAuthor : pchar; stdcall;
         This function returns the Author of the plugin.

function getName : pchar; stdcall;
         This function returns the name of the plugin.
function getSDKVersion : pchar; stdcall; *needed*
         This function returns the SDK version used by the plugin.
function

getSmallComment : pchar; stdcall;
         This function returns a small comment to describe the plugin.

function getVersion : pchar; stdcall;
         This function returns the version of the plugin.
procedure initPlugin(functions: TFunction; dir:pchar); stdcall; *needed*
         This function is called when the plugin is activated.
function inMenu : pchar; stdcall;
         This function returns the list of menu who sould be displayed in plugin menu.
function inPopupMenu : pchar; stdcall;
         This function returns the list of menu who sould be displayed in context menu in the list of game.
function inPopupMenuHave : pchar; stdcall;
         This function returns the list of menu who sould be displayed in context menu in the list of game (for having rom).
function inPopupMenuMiss : pchar; stdcall;
         This function returns the list of menu who sould be displayed in context menu in the list of game (for missing rom).
procedure onPopupMenuClick(act:Integer; game:TGame); stdcall;
         This procedure is called when the user click on the context menu of the list of game.
procedure onPopupMenuHaveClick(act:Integer; game:TGame); stdcall;
         This procedure is called when the user click on the context menu of the list of game (for having rom).
procedure onPopupMenuMissClick(act:Integer; game:TGame); stdcall;
         This procedure is called when the user click on the context menu of the list of game (for missing rom).
procedure onMenuClick(act:Integer); stdcall;
         This procedure is called when the user click on the plugin menu.
procedure rename(language:Integer); stdcall;
         This procedure is called at startup of OfflineList and when the user change the selected language.
procedure setSize(rom: PPChar; size:pInteger; newSize:Integer); stdcall;
         This function is called by the application to allocate the good space to receive a rom.

 

Function/Procedure Detail

closePlugin

procedure closePlugin; stdcall;
This procedure is called when the plugin is deactivated.


Don't forget to free the memory allocated by your module.



getAuthor

function getAuthor : pchar; stdcall;
This function returns the author of the plugin.

Returns:
a PCHAR indicating the author of the plugin.

getName

function getName : pchar; stdcall;
This function returns the name of the plugin.

Returns:
a PCHAR indicating the name of the plugin.

getSDKVersion *needed*

function getSDKVersion : pchar; stdcall;
This function returns the SDK version used by the plugin.

You need to return a valid version to recieve the correct records.

Returns:
a PCHAR indicating the SDK version used.


getSmallComment

function getSmallComment : pchar; stdcall;
This function returns a comment to describe the plugin.

Returns:
a PCHAR indicating what the plugin do.

getVersion

function getVersion : pchar; stdcall;
This function returns the version of the plugin.

Returns:
a PCHAR indicating the plugin version.


initPlugin *needed*

procedure initPlugin(functions: TFunction; dir:pchar); stdcall;
This function is called when the plugin is activated.


You can store file configuration or anything in the directory "dir" you need to create it if it doesn't exist.

Parameters:
functions - A record who contains some address functions.

dir - the path where you can store file.


inMenu

function inMenu : pchar; stdcall;
This function returns the list of menu who sould be displayed in plugin menu.


If there are only one menu it will be directly displayed else if there at least 2 menus there will be sub-menu of a menu named like the plugin.


To add menu you need to concat the name and a null terminated character of all menu you want to use and finish this pchar by #0

Ex: result := 'menu1' + #0 + 'menu2' + #0 + #0;
You can also add a separator by naming a menu '-'.

Returns:
a PCHAR indicating the name of each menu.

inPopupMenu

function inPopupMenu : pchar; stdcall;
This function returns the list of menu who sould be displayed in context menu in the list of game.
The menu are dynamic, so each time OfflineList call, this function for recreate the menu.


If there are only one menu it will be directly displayed else if there at least 2 menus there will be sub-menu of a menu named like the plugin.


To add menu you need to concat the name and a null terminated character of all menu you want to use and finish this pchar by #0

Ex: result := 'popupMenu1' + #0 + 'popupMenu2' + #0 + #0;
You can also add a separator by naming a menu '-'.
Returns:
a PCHAR indicating the name of each popupMenu.

inPopupMenuHave

function inPopupMenuHave : pchar; stdcall;
This function returns the list of menu who sould be displayed in context menu in the list of game (for having rom).
The menu are dynamic, so each time OfflineList call, this function for recreate the menu.


If there are only one menu it will be directly displayed else if there at least 2 menus there will be sub-menu of a menu named like the plugin.


To add menu you need to concat the name and a null terminated character of all menu you want to use and finish this pchar by #0

Ex: result := 'popupMenu1' + #0 + 'popupMenu2' + #0 + #0;
You can also add a separator by naming a menu '-'.
Returns:
a PCHAR indicating the name of each popupMenu.

inPopupMenuMiss

function inPopupMenuMiss : pchar; stdcall;
This function returns the list of menu who sould be displayed in context menu in the list of game (for missing rom).
The menu are dynamic, so each time OfflineList call, this function for recreate the menu.


If there are only one menu it will be directly displayed else if there at least 2 menus there will be sub-menu of a menu named like the plugin.


To add menu you need to concat the name and a null terminated character of all menu you want to use and finish this pchar by #0

Ex: result := 'popupMenu1' + #0 + 'popupMenu2' + #0 + #0;
You can also add a separator by naming a menu '-'.
Returns:
a PCHAR indicating the name of each popupMenu.

onPopupMenuClick

procedure onPopupMenuClick(act:Integer; game:PGame); stdcall;
This procedure is called when the user click on the context menu of the list of game.


The "act" integer indicate wich menu is clicked 0 for the first menu, 1 for the second, ... .


game is the clicked game,

game^.nextGame are the first selected rom in the list,

game^.nextGame^.nextGame are the second selected rom in the list,

....

until nextGame are nil.

Parameters:
act - Indicating the menu clicked 0 for the first menu, 1 for the second, .... .

game - a record indicating information about the rom clicked.

onPopupMenuHaveClick

procedure onPopupMenuHaveClick(act:Integer; game:PGame); stdcall;
This procedure is called when the user click on the context menu of the list of game (for having rom).


The "act" integer indicate wich menu is clicked 0 for the first menu, 1 for the second, ... .


game is the clicked game,

game^.nextGame are the first selected rom in the list,

game^.nextGame^.nextGame are the second selected rom in the list,

....

until nextGame are nil.

Parameters:
act - Indicating the menu clicked 0 for the first menu, 1 for the second, .... .

game - a record indicating information about the rom clicked.

onPopupMenuMissClick

procedure onPopupMenuMissClick(act:Integer; game:PGame); stdcall;
This procedure is called when the user click on the context menu of the list of game (for missing rom).


The "act" integer indicate wich menu is clicked 0 for the first menu, 1 for the second, ... .


game is the clicked game,

game^.nextGame are the first selected rom in the list,

game^.nextGame^.nextGame are the second selected rom in the list,

....

until nextGame are nil.

Parameters:
act - Indicating the menu clicked 0 for the first menu, 1 for the second, .... .

game - a record indicating information about the rom clicked.

onMenuClick

procedure onMenuClick(act:Integer); stdcall;
This procedure is called when the user click on the plugin menu.


The "act" integer indicate wich menu is clicked 0 for the first menu, 1 for the second, ... .

Parameters:
act - Indicating the menu clicked 0 for the first menu, 1 for the second, .... .

rename

procedure rename(language:Integer); stdcall;
This procedure is called at startup of OfflineList and when the user change the selected language.


The language value:

- 0 : English

- 1 : French

- 2 : Chinese (Simp)

- 3 : Chinese (Trad)

- 4 : German

- 5 : Dutch

- 6 : Italian

- 7 : Japanese

- 8 : Norwegian

- 9 : Polish

- 10 : Portuguese (Brazil)

- 11 : Spanish

- 12 : Spanish (Mexico)

- 13 : Swedish

- 14 : Danish

- 15 : Czech

- 16 : ...

Parameters:
language - Indicating the language selected in OfflineList.

setSize

procedure setSize(rom: PPChar; size:pInteger; newSize:Integer); stdcall;
This function is called by the application to allocate the good space to receive a rom.


This procedure need to allocate enougth space to receive the rom.

This procedure is called by the application to allocate space, and after it can be called by each module to inflate or deflate the size of the array, you need also to specified the new size into "size".


The procedure must be like that:

procedure setSize(rom: PPChar; size:pInteger; newSize:Integer); stdcall;
begin
  ReallocMem(rom^, newSize);
  size^ := newSize;
end;
Parameters:
rom - a pointer to an array of char who will contains the rom.

size - a pointer to an integer who indicate the size of the rom.

newSize - Indicate the new size for the rom.