Android: Clean up getting input plugin working

This commit is contained in:
zilmar 2022-07-18 22:26:29 +09:30
parent 885d2dfeb4
commit 35c2da49b1
4 changed files with 69 additions and 66 deletions

View File

@ -1,5 +1,5 @@
#include "Version.h"
#include <Project64-plugin-spec/Input.h> #include <Project64-plugin-spec/Input.h>
#include "Version.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -14,43 +14,41 @@ void ShowAboutWindow (void * hParent);
/* /*
Function: CloseDLL Function: CloseDLL
Purpose: This function is called when the emulator is closing Purpose: This function is called when the emulator is closing
down allowing the DLL to de-initialize. down allowing the DLL to de-initialize.
Input: None Input: None
Output: None Output: None
*/ */
EXPORT void CALL CloseDLL (void) EXPORT void CALL CloseDLL(void)
{ {
} }
/* /*
Function: ControllerCommand Function: ControllerCommand
Purpose: To process the raw data that has just been sent to a Purpose: To process the raw data that has just been sent to a
specific controller. specific controller.
Input: Controller Number (0 to 3) and -1 signaling end of Input: Controller number (0 to 3) and -1 signaling end of
processing the PIF RAM. processing the PIF RAM.
- Pointer of data to be processed. - Pointer of data to be processed.
Output: None Output: None
Note: This function is only needed if the DLL is allowing raw
Note: This function is only needed if the DLL is allowing raw data, or the plugin is set to raw.
data, or the plugin is set to raw
The data that is being processed looks like this: The data that is being processed looks like this:
Initialize controller: 01 03 00 FF FF FF Initialize controller: 01 03 00 FF FF FF
Read controller: 01 04 01 FF FF FF FF Read controller: 01 04 01 FF FF FF FF
*/ */
EXPORT void CALL ControllerCommand ( int /*Control*/, uint8_t * /*Command*/) EXPORT void CALL ControllerCommand(int32_t /*Control*/, uint8_t * /*Command*/)
{ {
} }
/* /*
Function: DllAbout Function: DllAbout
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to give further information about the DLL. to give further information about the DLL.
Input: A handle to the window that calls this function Input: A handle to the window that calls this function.
Output: None Output: None
*/ */
EXPORT void CALL DllAbout ( void * hParent ) EXPORT void CALL DllAbout ( void * hParent )
@ -62,10 +60,10 @@ EXPORT void CALL DllAbout ( void * hParent )
/* /*
Function: DllConfig Function: DllConfig
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to allow the user to configure the DLL to allow the user to configure the DLL.
Input: A handle to the window that calls this function Input: A handle to the window that calls this function.
Output: None Output: None
*/ */
EXPORT void CALL DllConfig ( void * /*hParent*/ ) EXPORT void CALL DllConfig ( void * /*hParent*/ )
@ -74,46 +72,48 @@ EXPORT void CALL DllConfig ( void * /*hParent*/ )
/* /*
Function: DllTest Function: DllTest
Purpose: This function is optional function that is provided Purpose: This function is optional function that is provided
to allow the user to test the DLL to allow the user to test the DLL.
Input: A handle to the window that calls this function Input: A handle to the window that calls this function.
Output: None Output: None
*/ */
EXPORT void CALL DllTest ( void * /*hParent*/ ) EXPORT void CALL DllTest(void * /*hParent*/)
{ {
} }
/* /*
Function: GetDllInfo Function: GetDllInfo
Purpose: This function allows the emulator to gather information Purpose: This function allows the emulator to gather information
about the DLL by filling in the PluginInfo structure. about the DLL by filling in the PluginInfo structure.
Input: A pointer to a PLUGIN_INFO structure that needs to be Input: A pointer to a PLUGIN_INFO structure that needs to be
filled by the function. (see def above) filled by the function. (see def above)
Output: None Output: None
*/ */
EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo ) EXPORT void CALL GetDllInfo(PLUGIN_INFO * PluginInfo)
{ {
PluginInfo->Version = 0x0101; PluginInfo->Version = CONTROLLER_SPECS_VERSION;
PluginInfo->Type = PLUGIN_TYPE_CONTROLLER; PluginInfo->Type = PLUGIN_TYPE_CONTROLLER;
#ifdef _DEBUG #ifdef _DEBUG
sprintf(PluginInfo->Name, "Android input debug plugin %s", VER_FILE_VERSION_STR); sprintf(PluginInfo->Name, "Android input debug plugin %s", VER_FILE_VERSION_STR);
#else #else
sprintf(PluginInfo->Name, "Android input plugin %s", VER_FILE_VERSION_STR); sprintf(PluginInfo->Name, "Android input plugin %s", VER_FILE_VERSION_STR);
#endif #endif
PluginInfo->Reserved2 = true;
PluginInfo->Reserved1 = false;
} }
/* /*
Function: GetKeys Function: GetKeys
Purpose: To get the current state of the controllers buttons. Purpose: To get the current state of the controllers buttons.
Input: Controller Number (0 to 3) Input: Controller number (0 to 3)
- A pointer to a BUTTONS structure to be filled with - A pointer to a BUTTONS structure to be filled with
the controller state. the controller state.
Output: None Output: None
*/ */
EXPORT void CALL GetKeys(int Control, BUTTONS * Keys ) EXPORT void CALL GetKeys(int32_t Control, BUTTONS * Keys)
{ {
if (Control == 0) if (Control == 0)
{ {
@ -123,15 +123,14 @@ EXPORT void CALL GetKeys(int Control, BUTTONS * Keys )
/* /*
Function: InitiateControllers Function: InitiateControllers
Purpose: This function initializes how each of the controllers Purpose: This function initializes how each of the controllers
should be handled. should be handled.
Input: The handle to the main window. Input: A controller structure that needs to be filled for
- A controller structure that needs to be filled for
the emulator to know how to handle each controller. the emulator to know how to handle each controller.
Output: None Output: None
*/ */
EXPORT void CALL InitiateControllers (CONTROL_INFO * ControlInfo) EXPORT void CALL InitiateControllers(CONTROL_INFO * ControlInfo)
{ {
g_control_info = *ControlInfo; g_control_info = *ControlInfo;
g_control_info.Controls[0].Present = true; g_control_info.Controls[0].Present = true;
@ -140,65 +139,69 @@ EXPORT void CALL InitiateControllers (CONTROL_INFO * ControlInfo)
/* /*
Function: ReadController Function: ReadController
Purpose: To process the raw data in the PIF RAM that is about to Purpose: To process the raw data in the PIF RAM that is about to
be read. be read.
Input: Controller Number (0 to 3) and -1 signaling end of Input: Controller number (0 to 3) and -1 signaling end of
processing the PIF RAM. processing the PIF RAM.
- Pointer of data to be processed. - Pointer of data to be processed.
Output: None Output: None
Note: This function is only needed if the DLL is allowing raw Note: This function is only needed if the DLL is allowing raw
data. data.
*/ */
EXPORT void CALL ReadController ( int /*Control*/, uint8_t * /*Command*/ ) EXPORT void CALL ReadController(int /*Control*/, uint8_t * /*Command*/)
{ {
} }
/* /*
Function: RomClosed Function: RomClosed
Purpose: This function is called when a ROM is closed. Purpose: This function is called when a ROM is closed.
Input: None Input: None
Output: None Output: None
*/ */
EXPORT void CALL RomClosed (void) EXPORT void CALL RomClosed(void)
{ {
} }
/* /*
Function: RomOpen Function: RomOpen
Purpose: This function is called when a ROM is open (from the Purpose: This function is called when a ROM is open. (from the
emulation thread) emulation thread)
Input: None Input: None
Output: None Output: None
*/ */
EXPORT void CALL RomOpen (void) EXPORT void CALL RomOpen(void)
{ {
memset(&g_buttons, 0, sizeof(g_buttons)); memset(&g_buttons, 0, sizeof(g_buttons));
} }
/* /*
Function: WM_KeyDown Function: WM_KeyDown
Purpose: To pass the WM_KeyDown message from the emulator to the Purpose: To pass the WM_KeyDown message from the emulator to the
plugin. plugin.
Input: wParam and lParam of the WM_KEYDOWN message. Input: wParam and lParam of the WM_KEYDOWN message.
Output: None Output: None
*/ */
EXPORT void CALL WM_KeyDown( uint32_t /*wParam*/, uint32_t /*lParam*/ ) EXPORT void CALL WM_KeyDown(uint32_t /*wParam*/, uint32_t /*lParam*/)
{ {
} }
/* /*
Function: WM_KeyUp Function: WM_KeyUp
Purpose: To pass the WM_KEYUP message from the emulator to the Purpose: To pass the WM_KEYUP message from the emulator to the
plugin. plugin.
Input: wParam and lParam of the WM_KEYDOWN message. Input: wParam and lParam of the WM_KEYDOWN message.
Output: None Output: None
*/ */
EXPORT void CALL WM_KeyUp( uint32_t /*wParam*/, uint32_t /*lParam*/ ) EXPORT void CALL WM_KeyUp(uint32_t /*wParam*/, uint32_t /*lParam*/)
{
}
EXPORT void CALL PluginLoaded(void)
{ {
} }

View File

@ -637,7 +637,7 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
CN64Rom::CleanRomName(RomName, false); CN64Rom::CleanRomName(RomName, false);
} }
WriteTrace(TraceN64System, TraceDebug, "RomName %s", RomName); WriteTrace(TraceN64System, TraceDebug, "RomName \"%s\"", RomName);
m_RomName = RomName; m_RomName = RomName;
m_FileName = FileLoc; m_FileName = FileLoc;

View File

@ -65,9 +65,9 @@ void CPlugins::PluginChanged(CPlugins * _this)
bool bContChange = _stricmp(_this->m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0; bool bContChange = _stricmp(_this->m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str()) != 0;
bool bDirChange = _stricmp(_this->m_PluginDir.c_str(), g_Settings->LoadStringVal(_this->m_PluginDirSetting).c_str()) != 0; bool bDirChange = _stricmp(_this->m_PluginDir.c_str(), g_Settings->LoadStringVal(_this->m_PluginDirSetting).c_str()) != 0;
WriteTrace(TracePlugins, TraceVerbose, "m_GfxFile: \"%s\" Game_Plugin_Gfx: \"%s\" changed: %s", _this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str(), bGfxChange ? "true" : "false"); WriteTrace(TracePlugins, TraceVerbose, "m_GfxFile: \"%s\" Game_Plugin_Gfx: \"%s\" changed: %s", _this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str(), bGfxChange ? "true" : "false");
WriteTrace(TracePlugins, TraceVerbose, "m_AudioFile: \"%s\" Game_Plugin_Audio: \"%s\" changed: %s", _this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str(), bAudioChange ? "true" : "false"); WriteTrace(TracePlugins, TraceVerbose, "m_AudioFile: \"%s\" Game_Plugin_Audio: \"%s\" changed: %s", _this->m_AudioFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Audio).c_str(), bAudioChange ? "true" : "false");
WriteTrace(TracePlugins, TraceVerbose, "m_RSPFile: \"%s\" Game_Plugin_RSP: \"%s\" changed: %s", _this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str(), bRspChange ? "true" : "false"); WriteTrace(TracePlugins, TraceVerbose, "m_RSPFile: \"%s\" Game_Plugin_RSP: \"%s\" changed: %s", _this->m_RSPFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_RSP).c_str(), bRspChange ? "true" : "false");
WriteTrace(TracePlugins, TraceVerbose, "m_ControlFile: \"%s\" Game_Plugin_Controller: \"%s\" changed: %s", _this->m_GfxFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Gfx).c_str(), bContChange ? "true" : "false"); WriteTrace(TracePlugins, TraceVerbose, "m_ControlFile: \"%s\" Game_Plugin_Controller: \"%s\" changed: %s", _this->m_ControlFile.c_str(), g_Settings->LoadStringVal(Game_Plugin_Controller).c_str(), bContChange ? "true" : "false");
WriteTrace(TracePlugins, TraceVerbose, "m_PluginDir: \"%s\" m_PluginDirSetting: \"%s\" changed: %s", _this->m_PluginDir.c_str(), g_Settings->LoadStringVal(_this->m_PluginDirSetting).c_str(), bDirChange ? "true" : "false"); WriteTrace(TracePlugins, TraceVerbose, "m_PluginDir: \"%s\" m_PluginDirSetting: \"%s\" changed: %s", _this->m_PluginDir.c_str(), g_Settings->LoadStringVal(_this->m_PluginDirSetting).c_str(), bDirChange ? "true" : "false");
if (bDirChange) if (bDirChange)
{ {

View File

@ -385,7 +385,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
#endif #endif
#else #else
AddHandler(Plugin_RSP_Current, new CSettingTypeApplication("Plugin", "RSP Dll", "libProject64-rsp-hle.so")); AddHandler(Plugin_RSP_Current, new CSettingTypeApplication("Plugin", "RSP Dll", "libProject64-rsp-hle.so"));
AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin", "Graphics Dll", "libProject64-gfx.so")); AddHandler(Plugin_GFX_Current, new CSettingTypeApplication("Plugin", "Graphics Dll", "libProject64-video.so"));
AddHandler(Plugin_AUDIO_Current, new CSettingTypeApplication("Plugin", "Audio Dll", "libProject64-audio-android.so")); AddHandler(Plugin_AUDIO_Current, new CSettingTypeApplication("Plugin", "Audio Dll", "libProject64-audio-android.so"));
AddHandler(Plugin_CONT_Current, new CSettingTypeApplication("Plugin", "Controller Dll", "libProject64-input-android.so")); AddHandler(Plugin_CONT_Current, new CSettingTypeApplication("Plugin", "Controller Dll", "libProject64-input-android.so"));
#endif #endif