pad somehow working

This commit is contained in:
georgemoralis 2023-10-13 17:44:15 +03:00
parent da9adf84c0
commit e1b64617a8
3 changed files with 11 additions and 7 deletions

View File

@ -4,7 +4,7 @@
namespace Emulator::Host::Controller {
struct State {
u32 buttonsState;
u32 buttonsState =0;
};
constexpr u32 MAX_STATES = 64;

View File

@ -3,10 +3,15 @@
#include <Core/PS4/HLE/ErrorCodes.h>
#include <Core/PS4/HLE/Libs.h>
#include "Emulator/Util/singleton.h"
#include "Util/Singleton.h"
#include "controller.h"
#include <debug.h>
#include <Util/log.h>
namespace Emulator::HLE::Libraries::LibPad {
constexpr bool log_file_pad = true; // disable it to disable logging
int PS4_SYSV_ABI scePadInit() { return SCE_OK; }
int PS4_SYSV_ABI scePadOpen(Emulator::HLE::Libraries::LibUserService::SceUserServiceUserId userId, s32 type, s32 index,
@ -15,17 +20,16 @@ int PS4_SYSV_ABI scePadOpen(Emulator::HLE::Libraries::LibUserService::SceUserSer
}
int PS4_SYSV_ABI scePadReadState(int32_t handle, ScePadData* pData) {
auto* controller = singleton<Emulator::Host::Controller::GameController>::instance();
auto* controller = Singleton<Emulator::Host::Controller::GameController>::Instance();
int connectedCount = 0;
bool isConnected = false;
Emulator::Host::Controller::State state;
controller->readState(&state, &isConnected, &connectedCount);
pData->buttons = state.buttonsState;
pData->leftStick.x = 0; // dummy
pData->leftStick.y = 0; // dummy
pData->leftStick.x = 128; // dummy
pData->leftStick.y = 128; // dummy
pData->rightStick.x = 0; // dummy
pData->rightStick.y = 0; // dummy
pData->analogButtons.r2 = 0;//dummy

View File

@ -1,13 +1,13 @@
#include "emulator.h"
#include <Core/PS4/HLE/Graphics/graphics_render.h>
#include <Emulator/HLE/Libraries/LibPad/controller.h>
#include <Util/Singleton.h>
#include <vulkan_util.h>
#include "Core/PS4/HLE/Graphics/video_out.h"
#include "Emulator/HLE/Libraries/LibPad/pad.h"
#include "version.h"
#include <Emulator/HLE/Libraries/LibPad/controller.h>
namespace Emu {