Next Generation Emulation banner
1 - 3 of 3 Posts

· Enjoy writing plugins...
Joined
·
52 Posts
Discussion Starter · #1 ·
Hi,
I'm trying to write a pad plugin on PSXeven.
I've found the following description:

data contents of normal PAD.(push low)
byte b7 b6 b5 b4 b3 b2 b1 b0
0 --- N.A.
1 0x41 'A'
2 0x5a 'Z'
3 LEFT DOWN RGHT UP STA 1 1 SEL
4 Square X O Triangle R1 L1 R2 L2

I use the description of 3rd and 4th bytes to form "unsigned short buttonStatus" in struct PadDataS like this:
0xFFDF -> Right
0xDFFF -> Circle
etc.

The problem is, some games works w/o problem, but some others behave odd. It seems that 0x0020 -> Right, 0x2000 -> Circle is the right way.
I think there shouldn't be any difference between games in pad processing, so there must be something wrong in my code.
What's probably wrong w/ my code?
 

· Enjoy writing plugins...
Joined
·
52 Posts
Discussion Starter · #3 · (Edited)
I've simplified the code to the simplest form, but the problem remains on PSXeven(no problem on other emulators):

#include <windows.h>
#include "PSEmu_Plugin_Defs.h"

ULONG CALLBACK PSEgetLibType()
{
return PSE_LT_PAD;
}

PCHAR CALLBACK PSEgetLibName()
{
return "test pad plugin";
}

ULONG CALLBACK PSEgetLibVersion()
{
return (1 << 16) | (1 << 8) | 1;
}

LONG CALLBACK PADinit(LONG lFlag)
{
return PSE_INIT_ERR_SUCCESS;
}

VOID CALLBACK PADshutdown()
{

}

LONG CALLBACK PADopen(HWND hWnd)
{
return PSE_PAD_ERR_SUCCESS;
}

LONG CALLBACK PADclose()
{
return PSE_PAD_ERR_SUCCESS;
}

LONG CALLBACK PADreadPort1(PadDataS * pData)
{
pData->controllerType = PSE_PAD_TYPE_STANDARD;

pData->buttonStatus = 0xFFFF;

if(GetAsyncKeyState(VK_RIGHT))
pData->buttonStatus = 0xFFDF;
// ...

return PSE_PAD_ERR_SUCCESS;
}

LONG CALLBACK PADreadPort2(PadDataS * pData)
{
return PSE_PAD_ERR_SUCCESS;
}

LONG CALLBACK PADquery()
{
return PSE_PAD_USE_PORT1 | PSE_PAD_USE_PORT2;
}

LONG CALLBACK PADconfigure()
{
return PSE_PAD_ERR_SUCCESS;
}

LONG CALLBACK PADtest()
{
return PSE_PAD_ERR_SUCCESS;
}

VOID CALLBACK PADabout()
{
}
 
1 - 3 of 3 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top