C/C++ 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:

typedef void (__stdcall FSetSize)(char **rom, long *size, long newSize); // this function is called to allocate memory to the rom.
     rom is a Pointer to a char*, 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: *rom = (char *)realloc(*rom, newSize);	*size = newSize;

typedef void (__stdcall FPGetRom)(char **rom, long *size, char *crc, long, FSetSize); // you can call this function to get rom.
     rom : is a Pointer to a char*, 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.

typedef void (__stdcall FPLaunchEmulatorFile)(char *filename); // 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" typedef void (__stdcall FPLaunchEmulatorCRC)(char *crc); // you can call this function to launch the emulator. crc : indicate the crc of the rom you want play with the emulator. typedef void (__stdcall FPAddRoms)(char *crc); // this function permit you to add roms by indicating the path of the roms. roms is a char* who contains one or more roms (zipped or not). You need to concat all the path of all roms add finish the char* by \0\0. Exemple: - for one rom: roms := "C:\dir\foo.zip\0\0"; - for more than one rom: roms := "C:\dir\foo.zip\0D:\dir\foo2.gba\0 ... D:\dir\foox.gba\0\0";
SDK version "0.4" :
typedef struct s_game{
   s_game *nextGame; // the next game selected.
   char *crc; // indicate the crc of the rom file.
   char *name; // indicate the name of the game.
   char *named; // indicate the rom naming.
   long num; // indicate the release number of the rom.
   long size; // 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 & 256) != 0){ the Danish language is in the game. }
char *save; // indicate the save type of the rom. char *publisher; // this is the publisher of the game. char *sourceRom; // this is the group who release the first dump available for the rom. char *comment; // this is the comment available for this rom. } s_game;
typedef struct {
   FPGetRom *getRom; // call this function to receive a rom.
FPLaunchEmulatorFile *launchEmulatorFile; // call this function to launch the emulator on a spécified file.
FPLaunchEmulatorCRC *launchEmulatorCRC; // call this function to launch the emulator on the game who have the specified CRC. FPAddRoms *addRoms; // with this function you can add roms to OfflineList. } s_functions;

Old sdk version : 0.1 0.2 0.3



Function Summary
void __stdcall closePlugin()
          This function is called when the plugin is deactivated.
char* __stdcall getAuthor()
         This function returns the Author of the plugin.
char* __stdcall getName()
         This function returns the name of the plugin.
char* __stdcall getSDKVersion()
         This function returns the SDK version used by the plugin. *needed*
char* __stdcall getSmallComment()
         This function returns a small comment to describe the plugin.
char* __stdcall getVersion()
         This function returns the version of the plugin.
void __stdcall initPlugin(s_functions functions, char * dir) *needed*
         This function is called when the plugin is activated.
char* __stdcall inMenu()
         This function returns the list of menu who sould be displayed in plugin menu.
char* __stdcall inPopupMenu()
         This function returns the list of menu who sould be displayed in context menu in the list of game.
char* __stdcall inPopupMenuHave()
         This function returns the list of menu who sould be displayed in context menu in the list of game (for having rom).
char* __stdcall inPopupMenuMiss()
         This function returns the list of menu who sould be displayed in context menu in the list of game (for missing rom).
void __stdcall onPopupMenuClick(long act, s_game game)
         This function is called when the user click on the context menu of the list of game.
void __stdcall onPopupMenuHaveClick(long act, s_game game)
         This function is called when the user click on the context menu of the list of game (for having rom).
void __stdcall onPopupMenuMissClick(long act, s_game game)
         This function is called when the user click on the context menu of the list of game (for missing rom).
void __stdcall onMenuClick(long act)
         This function is called when the user click on the plugin menu.
void __stdcall rename(long language)
         This function is called at startup of OfflineList and when the user change the selected language.
void __stdcall setSize(char ** rom, long * size, long newSize)
         This function is called by the application to allocate the good space to receive a rom.

 

Function Detail

closePlugin

void __stdcall closePlugin()
This function is called when the plugin is deactivated.


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



getAuthor

char* __stdcall getAuthor()
This function returns the author of the plugin.

Returns:
a char* indicating the author of the plugin.

getName

char* __stdcall getName()
This function returns the name of the plugin.

Returns:
a char* indicating the name of the plugin.

getSDKVersion *needed*

char* __stdcall getSDKVersion()
This function returns the SDK version used by the plugin.

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

Returns:
a char* indicating the plugin version.


getSmallComment

char* __stdcall getSmallComment()
This function returns a comment to describe the plugin.

Returns:
a char* indicating what the plugin do.

getVersion

char* __stdcall getVersion()
This function returns the version of the plugin.

Returns:
a char* indicating the plugin version.


initPlugin *needed*

void __stdcall initPlugin(s_functions functions, char * dir)
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 struct who contains some address functions.

dir - the path where you can store file.


inMenu

char* __stdcall inMenu()
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: return "menu1\0menu2\0\0";

You can also add a separator by naming a menu "-".
Returns:
a char* indicating the name of each menu.

inPopupMenu

char* __stdcall inPopupMenu()
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: return "popupMenu1\0popupMenu2\0\0";
You can also add a separator by naming a menu "-".
Returns:
a char* indicating the name of each popupMenu.

inPopupMenuHave

char* __stdcall inPopupMenuHave()
This function returns the list of menu who sould be displayed in context menu in the list of game (for having roms).
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: return "popupMenu1\0popupMenu2\0\0";
You can also add a separator by naming a menu "-".
Returns:
a char* indicating the name of each popupMenu.

inPopupMenuMiss

char* __stdcall inPopupMenuMiss()
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: return "popupMenu1\0popupMenu2\0\0";
You can also add a separator by naming a menu "-".
Returns:
a char* indicating the name of each popupMenu.

onPopupMenuClick

__stdcall onPopupMenuClick(long act, s_game game)
This function 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 NULL.

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

game - a struct indicating information about the rom selected.

onPopupMenuHaveClick

__stdcall onPopupMenuHaveClick(long act, s_game game)
This function 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 NULL.

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

game - a struct indicating information about the rom selected.

onPopupMenuMissClick

__stdcall onPopupMenuMissClick(long act, s_game game)
This function 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 NULL.

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

game - a struct indicating information about the rom selected.

onMenuClick

__stdcall onMenuClick(long act)
This function 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

__stdcall rename(long language)
This function 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

__stdcall setSize(char ** rom, long * size, long newSize)
This function is called by the application to allocate the good space to receive a rom.


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

This function 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".


This function must be like that:

void __stdcall setSize(char **rom, long *size, long newSize)
{
*rom = (char *)realloc(*rom, newSize);
*size = newSize;
}
Parameters:
rom - a char** who will contains the rom.

size - an int* who indicate the size of the rom.

newSize - Indicate the new size for the rom.