What's new

Compiling Basic KeyBoard Plugin Error's

GuestX

New member
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

Emulator Developer
Moderator
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 :)
 
OP
G

GuestX

New member
Thank you Hacktarux!! :)
because i am trying to create a good input plugin ;)


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

Cyberman

Moderator
Moderator
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
Code:
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

Moderator
Moderator
More examples in BCB (code?)
Header for plugin for PSXemupro. ePSXe, etc.
Code:
#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
Code:
////////////////////////////////////////////////////////////////////////
// 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
 
OP
G

GuestX

New member
can you modify zilmar's basic keyboard plugin &
add these functions & post the code? :blush: then i can see all....
 
OP
G

GuestX

New member
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...
 
Last edited:
OP
G

GuestX

New member
it works now!!

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

Code:
LIBRARY N64_Plugin.dll
EXPORTS
GetDllInfo @1; GetDllInfo

it works
 

Top