PDA

View Full Version : Compiling Basic KeyBoard Plugin Error's



GuestX
March 1st, 2003, 08:26
I tried yesterday to compile Zilmar's Basic KeyBoard Plugin
with Borland C++ Builder 6. But When i copy the Compiled
Plugin into Mupen64's Plugin Folder, and try to choose it
in the Plugin System, Mupen64 dosn't read the Plugin, the
same by Apollo and the others.

Hacktarux
March 1st, 2003, 14:00
I rememeber Cyberman was talking about this problem and fixed it. It has something to do with calling conventions used in bcb. Try to search archives of this board or wait for cyb :)

GuestX
March 1st, 2003, 14:05
Thank you Hacktarux!! :)
because i am trying to create a good input plugin ;)


C.Y.B.E.R.M.A.N. Where are you?

GuestX
March 1st, 2003, 21:14
This

http://www.emutalk.net/showthread.php?s=&threadid=9145&highlight=bcb


i don't understand that!
my english! :blush:

Cyberman
March 3rd, 2003, 21:43
Sculleater... I suggest doing the following for your functions.

CALLBACK <function definition>
This seems to work just fine with VC++ and BCB also the DLL exports the function names with _'s .. less work that way.

To find out what your DLL's exported functions are do IMPDEF <DLL NAME> <DLL NAME> without the extension

IE
IMPDEF PSXmem PSXmem
makes a file called PSXmem.def from PSXmem.dll.

The def file in my case would look like


LIBRARY PSXMEM.DLL

EXPORTS
_DLL_Count @1 ; _DLL_Count
_Game_About @5 ; _Game_About
_Game_Author @7 ; _Game_Author
_Game_Close @9 ; _Game_Close
_Game_Count @2 ; _Game_Count
_Game_Edit @4 ; _Game_Edit
_Game_Init @8 ; _Game_Init
_Game_List @3 ; _Game_List
_Game_Name @6 ; _Game_Name
_Get_Game @10 ; _Get_Game
_Get_Status @13 ; _Get_Status
_Set_Game @11 ; _Set_Game
_Set_RegGame @12 ; _Set_RegGame
___CPPdebugHook @14 ; ___CPPdebugHook

Cyb
PS: this DLL does not use CALLBACK but it works because I've tested it with ePSXe.

Cyberman
March 3rd, 2003, 21:51
More examples in BCB (code?)
Header for plugin for PSXemupro. ePSXe, etc.


#ifndef _PI_UNIT_H_
#define _PI_UNIT_H_

#include "PSEmu Plugin Defs.h"
#include "GPU_Unit.h"

#ifdef __BUILDING_THE_DLL
#define __EXPORT_TYPE(DEF) extern "C" DEF __export CALLBACK
#else
#define __EXPORT_TYPE(DEF) extern "C" DEF __import CALLBACK
#endif


typedef struct
{
unsigned long ulFreezeVersion; // should be always 1 for now (set by main emu)
unsigned long ulStatus; // current gpu status
unsigned long ulControl[256]; // latest control register values
unsigned char psxVRam[1024*512*2]; // current VRam image
} GPUFreeze_t;


__EXPORT_TYPE(char *) PSEgetLibName(void);
__EXPORT_TYPE(unsigned long) PSEgetLibType(void);
__EXPORT_TYPE(unsigned long) PSEgetLibVersion(void);
__EXPORT_TYPE(long) GPUinit();
__EXPORT_TYPE(long) GPUshutdown();
__EXPORT_TYPE(void) GPUmakeSnapshot(void);
__EXPORT_TYPE(long) GPUopen(HWND hwndGPU);
__EXPORT_TYPE(long) GPUclose();
__EXPORT_TYPE(void) GPUupdateLace(void);
__EXPORT_TYPE(unsigned long) GPUreadStatus(void);
__EXPORT_TYPE(void) GPUwriteStatus(unsigned long gdata);
__EXPORT_TYPE(unsigned long) GPUreadData(void);
__EXPORT_TYPE(void) GPUreadDataMem(unsigned long * pMem, int iSize);
__EXPORT_TYPE(void) GPUwriteData(unsigned long gdata);
__EXPORT_TYPE(void) GPUwriteDataMem(unsigned long * pMem, int iSize);
__EXPORT_TYPE(void) GPUsetMode(unsigned long gdata);
__EXPORT_TYPE(long) GPUgetMode(void);
__EXPORT_TYPE(long) GPUdmaChain(unsigned long * baseAddrL, unsigned long addr);
__EXPORT_TYPE(long) GPUconfigure(void);
__EXPORT_TYPE(void) GPUabout(void);
__EXPORT_TYPE(long) GPUtest(void);
__EXPORT_TYPE(void) GPUdisplayText(char * pText);
__EXPORT_TYPE(void) GPUdisplayFlags(unsigned long dwFlags);
__EXPORT_TYPE(long) GPUfreeze(unsigned long ulGetFreezeData,GPUFreeze_t * pF);


#endif

Code Snipet from the the .cpp file


////////////////////////////////////////////////////////////////////////
// stuff to make this a true PDK module
////////////////////////////////////////////////////////////////////////


char * CALLBACK PSEgetLibName(void)
{
return libraryName;
}

unsigned long CALLBACK PSEgetLibType(void)
{
return PSE_LT_GPU;
}

unsigned long CALLBACK PSEgetLibVersion(void)
{
return version<<16|revision<<8|build;
}

////////////////////////////////////////////////////////////////////////
// Init/shutdown, will be called just once on emu start/close
////////////////////////////////////////////////////////////////////////

long CALLBACK GPUinit() // GPU INIT
{
// load configuration information here
CFG_LoadGPU_Settings();

return 0;
}

long CALLBACK GPUshutdown() // GPU SHUTDOWN
{
return 0;
}


Cyb

GuestX
March 3rd, 2003, 22:34
can you modify zilmar's basic keyboard plugin &
add these functions & post the code? :blush: then i can see all....

GuestX
March 4th, 2003, 12:09
a question :blush: : i don't have any clue about SDL,
but is SDL input better than basic keyboard stuff?


PS: in my plugin i added already buttons assignment
for controller1 and a option "active". I'd like to....
but the main functions...

GuestX
March 6th, 2003, 14:44
it works now!!

Cyberman: the functions are exported without _'s :)



LIBRARY N64_Plugin.dll
EXPORTS
GetDllInfo @1; GetDllInfo


it works