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 "Version.h"
#include <stdio.h>
#include <string.h>
@ -20,7 +20,7 @@ Input: None
Output: None
*/
EXPORT void CALL CloseDLL (void)
EXPORT void CALL CloseDLL(void)
{
}
@ -28,20 +28,18 @@ EXPORT void CALL CloseDLL (void)
Function: ControllerCommand
Purpose: To process the raw data that has just been sent to a
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.
- Pointer of data to be processed.
Output: None
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:
Initialize controller: 01 03 00 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*/)
{
}
@ -49,7 +47,7 @@ EXPORT void CALL ControllerCommand ( int /*Control*/, uint8_t * /*Command*/)
Function: DllAbout
Purpose: This function is optional function that is provided
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
*/
@ -63,8 +61,8 @@ EXPORT void CALL DllAbout ( void * hParent )
/*
Function: DllConfig
Purpose: This function is optional function that is provided
to allow the user to configure the DLL
Input: A handle to the window that calls this function
to allow the user to configure the DLL.
Input: A handle to the window that calls this function.
Output: None
*/
@ -75,12 +73,12 @@ EXPORT void CALL DllConfig ( void * /*hParent*/ )
/*
Function: DllTest
Purpose: This function is optional function that is provided
to allow the user to test the DLL
Input: A handle to the window that calls this function
to allow the user to test the DLL.
Input: A handle to the window that calls this function.
Output: None
*/
EXPORT void CALL DllTest ( void * /*hParent*/ )
EXPORT void CALL DllTest(void * /*hParent*/)
{
}
@ -93,27 +91,29 @@ filled by the function. (see def above)
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;
#ifdef _DEBUG
sprintf(PluginInfo->Name, "Android input debug plugin %s", VER_FILE_VERSION_STR);
#else
sprintf(PluginInfo->Name, "Android input plugin %s", VER_FILE_VERSION_STR);
#endif
PluginInfo->Reserved2 = true;
PluginInfo->Reserved1 = false;
}
/*
Function: GetKeys
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
the controller state.
Output: None
*/
EXPORT void CALL GetKeys(int Control, BUTTONS * Keys )
EXPORT void CALL GetKeys(int32_t Control, BUTTONS * Keys)
{
if (Control == 0)
{
@ -125,13 +125,12 @@ EXPORT void CALL GetKeys(int Control, BUTTONS * Keys )
Function: InitiateControllers
Purpose: This function initializes how each of the controllers
should be handled.
Input: The handle to the main window.
- A controller structure that needs to be filled for
Input: A controller structure that needs to be filled for
the emulator to know how to handle each controller.
Output: None
*/
EXPORT void CALL InitiateControllers (CONTROL_INFO * ControlInfo)
EXPORT void CALL InitiateControllers(CONTROL_INFO * ControlInfo)
{
g_control_info = *ControlInfo;
g_control_info.Controls[0].Present = true;
@ -142,7 +141,7 @@ EXPORT void CALL InitiateControllers (CONTROL_INFO * ControlInfo)
Function: ReadController
Purpose: To process the raw data in the PIF RAM that is about to
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.
- Pointer of data to be processed.
Output: None
@ -150,7 +149,7 @@ Note: This function is only needed if the DLL is allowing raw
data.
*/
EXPORT void CALL ReadController ( int /*Control*/, uint8_t * /*Command*/ )
EXPORT void CALL ReadController(int /*Control*/, uint8_t * /*Command*/)
{
}
@ -161,19 +160,19 @@ Input: None
Output: None
*/
EXPORT void CALL RomClosed (void)
EXPORT void CALL RomClosed(void)
{
}
/*
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)
Input: None
Output: None
*/
EXPORT void CALL RomOpen (void)
EXPORT void CALL RomOpen(void)
{
memset(&g_buttons, 0, sizeof(g_buttons));
}
@ -186,7 +185,7 @@ Input: wParam and lParam of the WM_KEYDOWN message.
Output: None
*/
EXPORT void CALL WM_KeyDown( uint32_t /*wParam*/, uint32_t /*lParam*/ )
EXPORT void CALL WM_KeyDown(uint32_t /*wParam*/, uint32_t /*lParam*/)
{
}
@ -198,7 +197,11 @@ Input: wParam and lParam of the WM_KEYDOWN message.
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);
}
WriteTrace(TraceN64System, TraceDebug, "RomName %s", RomName);
WriteTrace(TraceN64System, TraceDebug, "RomName \"%s\"", RomName);
m_RomName = RomName;
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 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_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_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_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_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_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_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");
if (bDirChange)
{

View File

@ -385,7 +385,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
#endif
#else
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_CONT_Current, new CSettingTypeApplication("Plugin", "Controller Dll", "libProject64-input-android.so"));
#endif