1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-02-01 04:51:49 +01:00

Mouse support added

*Implemented 'cellMouse*' functions from 'sys_io' module, which are part
of the libmouse library.

* Added corresponding entries in the 'Config > Settings' menu to change
the handler of the mouse. Supported handlers: Windows, Null.

* cellGifDec: Fixed some errors and added support for RGBA color.

(Remember: The mouse support is very experimental)
This commit is contained in:
Alexandro Sánchez Bach 2013-09-14 20:20:57 +02:00
parent 1b7302c0ba
commit 1024a7c7c4
15 changed files with 578 additions and 25 deletions

38
rpcs3/Emu/Io/Mouse.cpp Normal file
View File

@ -0,0 +1,38 @@
#include "stdafx.h"
#include "Mouse.h"
#include "Null/NullMouseHandler.h"
#include "Windows/WindowsMouseHandler.h"
MouseManager::MouseManager()
: m_mouse_handler(nullptr)
, m_inited(false)
{
}
MouseManager::~MouseManager()
{
}
void MouseManager::Init(const u32 max_connect)
{
if(m_inited) return;
switch(Ini.MouseHandlerMode.GetValue())
{
case 1: m_mouse_handler = new WindowsMouseHandler(); break;
default:
case 0: m_mouse_handler = new NullMouseHandler(); break;
}
m_mouse_handler->Init(max_connect);
m_inited = true;
}
void MouseManager::Close()
{
if(m_mouse_handler) m_mouse_handler->Close();
m_mouse_handler = nullptr;
m_inited = false;
}

26
rpcs3/Emu/Io/Mouse.h Normal file
View File

@ -0,0 +1,26 @@
#pragma once
#include "MouseHandler.h"
class MouseManager //: public wxWindow
{
bool m_inited;
MouseHandlerBase* m_mouse_handler;
public:
MouseManager();
~MouseManager();
void Init(const u32 max_connect);
void Close();
Array<Mouse>& GetMice() { return m_mouse_handler->GetMice(); }
MouseInfo& GetInfo() { return m_mouse_handler->GetInfo(); }
CellMouseData& GetData(const u32 mouse) { return m_mouse_handler->GetData(mouse); }
CellMouseRawData& GetRawData(const u32 mouse) { return m_mouse_handler->GetRawData(mouse); }
bool IsInited() { return m_inited; }
//private:
//DECLARE_EVENT_TABLE();
};

160
rpcs3/Emu/Io/MouseHandler.h Normal file
View File

@ -0,0 +1,160 @@
#pragma once
enum MousePortStatus
{
CELL_MOUSE_STATUS_DISCONNECTED = 0x00000000,
CELL_MOUSE_STATUS_CONNECTED = 0x00000001,
};
enum MouseDataUpdate
{
CELL_MOUSE_DATA_UPDATE = 1,
CELL_MOUSE_DATA_NON = 0,
};
enum MouseButtonCodes
{
CELL_MOUSE_BUTTON_1 = 0x00000001,
CELL_MOUSE_BUTTON_2 = 0x00000002,
CELL_MOUSE_BUTTON_3 = 0x00000004,
CELL_MOUSE_BUTTON_4 = 0x00000008,
CELL_MOUSE_BUTTON_5 = 0x00000010,
CELL_MOUSE_BUTTON_6 = 0x00000020,
CELL_MOUSE_BUTTON_7 = 0x00000040,
CELL_MOUSE_BUTTON_8 = 0x00000080,
};
static const u32 CELL_MAX_MICE = 127;
static const u32 CELL_MOUSE_MAX_DATA_LIST_NUM = 8;
static const u32 CELL_MOUSE_MAX_CODES = 64;
struct MouseInfo
{
u32 max_connect;
u32 now_connect;
u32 info;
u16 vendor_id[CELL_MAX_MICE];
u16 product_id[CELL_MAX_MICE];
u8 status[CELL_MAX_MICE];
};
struct CellMouseRawData
{
s32 len;
u8 data[CELL_MOUSE_MAX_CODES];
CellMouseRawData()
: len(0)
{
}
};
struct CellMouseData
{
u8 update;
u8 buttons;
s8 x_axis;
s8 y_axis;
s8 wheel;
s8 tilt; // (TODO)
CellMouseData()
: update(0)
, buttons(0)
, x_axis(0)
, y_axis(0)
, wheel(0)
, tilt(0)
{
}
};
struct CellMouseDataList
{
u32 list_num;
CellMouseData list[CELL_MOUSE_MAX_DATA_LIST_NUM];
CellMouseDataList()
: list_num(0)
{
}
};
struct Mouse
{
s16 x_pos;
s16 y_pos;
CellMouseData m_data;
CellMouseRawData m_rawdata;
Mouse()
: m_data()
, m_rawdata()
{
}
};
class MouseHandlerBase
{
protected:
MouseInfo m_info;
Array<Mouse> m_mice;
public:
virtual void Init(const u32 max_connect)=0;
virtual void Close()=0;
void Button(u8 button, bool pressed)
{
for(u64 p=0; p<GetMice().GetCount(); ++p)
{
if (m_info.status[p] == CELL_MOUSE_STATUS_CONNECTED)
{
CellMouseData& data = GetData(p);
data.update = CELL_MOUSE_DATA_UPDATE;
if (pressed) data.buttons |= button;
else data.buttons &= ~button;
}
}
}
void Scroll(const s8 rotation)
{
for(u64 p=0; p<GetMice().GetCount(); ++p)
{
if (m_info.status[p] == CELL_MOUSE_STATUS_CONNECTED)
{
CellMouseData& data = GetData(p);
data.update = CELL_MOUSE_DATA_UPDATE;
data.wheel = rotation;
}
}
}
void Move(const s16 x_pos_new, const s16 y_pos_new)
{
for(u64 p=0; p<GetMice().GetCount(); ++p)
{
if (m_info.status[p] == CELL_MOUSE_STATUS_CONNECTED)
{
CellMouseData& data = GetData(p);
data.update = CELL_MOUSE_DATA_UPDATE;
data.x_axis += x_pos_new - GetMice()[p].x_pos;
data.y_axis += y_pos_new - GetMice()[p].y_pos;
GetMice()[p].x_pos = x_pos_new;
GetMice()[p].y_pos = y_pos_new;
/*CellMouseRawData& rawdata = GetRawData(p);
rawdata.data[rawdata.len % CELL_MOUSE_MAX_CODES] = 0; // (TODO)
rawdata.len++;*/
}
}
}
MouseInfo& GetInfo() { return m_info; }
Array<Mouse>& GetMice() { return m_mice; }
CellMouseData& GetData(const u32 mouse) { return GetMice()[mouse].m_data; }
CellMouseRawData& GetRawData(const u32 mouse) { return GetMice()[mouse].m_rawdata; }
};

View File

@ -0,0 +1,24 @@
#pragma once
#include "Emu/Io/MouseHandler.h"
class NullMouseHandler : public MouseHandlerBase
{
public:
NullMouseHandler()
{
}
virtual void Init(const u32 max_connect)
{
memset(&m_info, 0, sizeof(MouseInfo));
m_info.max_connect = max_connect;
m_mice.Clear();
}
virtual void Close()
{
memset(&m_info, 0, sizeof(MouseInfo));
m_mice.Clear();
}
};

View File

@ -0,0 +1,59 @@
#pragma once
#include "Emu/Io/MouseHandler.h"
class WindowsMouseHandler
: public wxWindow
, public MouseHandlerBase
{
AppConnector m_app_connector;
public:
WindowsMouseHandler() : wxWindow()
{
m_app_connector.Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(WindowsMouseHandler::MouseButtonDown), (wxObject*)0, this);
m_app_connector.Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(WindowsMouseHandler::MouseButtonDown), (wxObject*)0, this);
m_app_connector.Connect(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(WindowsMouseHandler::MouseButtonDown), (wxObject*)0, this);
m_app_connector.Connect(wxEVT_LEFT_UP, wxMouseEventHandler(WindowsMouseHandler::MouseButtonUp), (wxObject*)0, this);
m_app_connector.Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(WindowsMouseHandler::MouseButtonUp), (wxObject*)0, this);
m_app_connector.Connect(wxEVT_MIDDLE_UP, wxMouseEventHandler(WindowsMouseHandler::MouseButtonUp), (wxObject*)0, this);
m_app_connector.Connect(wxEVT_MOUSEWHEEL, wxMouseEventHandler(WindowsMouseHandler::MouseScroll), (wxObject*)0, this);
m_app_connector.Connect(wxEVT_MOTION, wxMouseEventHandler(WindowsMouseHandler::MouseMove), (wxObject*)0, this);
}
virtual void MouseButtonDown(wxMouseEvent& event)
{
if (event.LeftDown()) MouseHandlerBase::Button(CELL_MOUSE_BUTTON_1, 1);
else if (event.RightDown()) MouseHandlerBase::Button(CELL_MOUSE_BUTTON_2, 1);
else if (event.MiddleDown())MouseHandlerBase::Button(CELL_MOUSE_BUTTON_3, 1);
event.Skip();
}
virtual void MouseButtonUp(wxMouseEvent& event)
{
if (event.LeftUp()) MouseHandlerBase::Button(CELL_MOUSE_BUTTON_1, 0);
else if (event.RightUp()) MouseHandlerBase::Button(CELL_MOUSE_BUTTON_2, 0);
else if (event.MiddleUp()) MouseHandlerBase::Button(CELL_MOUSE_BUTTON_3, 0);
event.Skip();
}
virtual void MouseScroll(wxMouseEvent& event) { MouseHandlerBase::Scroll(event.GetWheelRotation()); event.Skip(); }
virtual void MouseMove(wxMouseEvent& event) { MouseHandlerBase::Move(event.m_x, event.m_y); event.Skip(); }
virtual void Init(const u32 max_connect)
{
m_mice.Move(new Mouse());
memset(&m_info, 0, sizeof(MouseInfo));
m_info.max_connect = max_connect;
m_info.now_connect = min<int>(GetMice().GetCount(), max_connect);
m_info.info = 0; // Ownership of mouse data: 0=Application, 1=System
m_info.status[0] = CELL_MOUSE_STATUS_CONNECTED; // (TODO: Support for more mice)
for(u32 i=1; i<max_connect; i++) m_info.status[i] = CELL_MOUSE_STATUS_DISCONNECTED;
m_info.vendor_id[0] = 0x1234;
m_info.product_id[0] = 0x1234;
}
virtual void Close()
{
memset(&m_info, 0, sizeof(MouseInfo));
m_mice.Clear();
}
};

View File

@ -21,6 +21,12 @@ enum
CELL_GIFDEC_ERROR_CB_PARAM = 0x80611307,
};
enum CellGifDecColorSpace
{
CELL_GIFDEC_RGBA = 10,
CELL_GIFDEC_ARGB = 20,
};
struct CellGifDecInfo
{
u32 SWidth;
@ -44,6 +50,33 @@ struct CellGifDecSrc
u32 spuThreadEnable; // CellGifDecSpuThreadEna
};
struct CellGifDecInParam
{
u32 *commandPtr;
u32 colorSpace; // CellGifDecColorSpace
u8 outputColorAlpha1;
u8 outputColorAlpha2;
u8 reserved[2];
};
struct CellGifDecOutParam
{
u64 outputWidthByte;
u32 outputWidth;
u32 outputHeight;
u32 outputComponents;
u32 outputBitDepth;
u32 outputColorSpace; // CellGifDecColorSpace
u32 useMemorySpace;
};
struct CellGifDecSubHandle //Custom struct
{
u32 fd;
u64 fileSize;
CellGifDecInParam inParam;
};
CellGifDecInfo current_info;
CellGifDecSrc current_src;
@ -70,22 +103,31 @@ int cellGifDecOpen(u32 mainHandle, u32 subHandle_addr, u32 src_addr, u32 openInf
//current_src.streamSize = Memory.Read32(src_addr+20);
//current_src.spuThreadEnable = Memory.Read32(src_addr+24);
u32& fd_addr = subHandle_addr; // Set file descriptor as sub handler of the decoder
CellGifDecSubHandle *subHandle = new CellGifDecSubHandle;
// Get file descriptor
u32 fd_addr = Memory.Alloc(sizeof(u32), 1);
int ret = cellFsOpen(current_src.fileName, 0, fd_addr, NULL, 0);
subHandle->fd = Memory.Read32(fd_addr);
Memory.Free(fd_addr);
if(ret != 0) return CELL_GIFDEC_ERROR_OPEN_FILE;
// Get size of file
u32 sb_addr = Memory.Alloc(52,1); // Alloc a CellFsStat struct
cellFsFstat(subHandle->fd, sb_addr);
subHandle->fileSize = Memory.Read64(sb_addr+36); // Get CellFsStat.st_size
Memory.Free(sb_addr);
// From now, every u32 subHandle argument is a pointer to a CellPngDecSubHandle struct.
Memory.Write32(subHandle_addr, (u32)subHandle);
return CELL_OK;
}
int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, u32 info_addr)
{
u32& fd = subHandle;
//Check size of file
u32 sb_addr = Memory.Alloc(52,1); // Alloc a CellFsStat struct
cellFsFstat(fd, sb_addr);
u64 fileSize = Memory.Read64(sb_addr+36); // Get CellFsStat.st_size
Memory.Free(sb_addr);
const u32& fd = ((CellGifDecSubHandle*)subHandle)->fd;
const u64& fileSize = ((CellGifDecSubHandle*)subHandle)->fileSize;
//Write the header to buffer
u32 buffer = Memory.Alloc(13,1); // Alloc buffer for GIF header
@ -126,21 +168,21 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, u32 info_addr)
return CELL_OK;
}
int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, u32 inParam, u32 outParam)
int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, u32 inParam_addr, u32 outParam_addr)
{
UNIMPLEMENTED_FUNC(cellGifDec);
CellGifDecInParam& inParam = ((CellGifDecSubHandle*)subHandle)->inParam;
inParam.colorSpace = Memory.Read32(inParam_addr+4);
// (TODO)
return CELL_OK;
}
int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, u32 data_addr, u32 dataCtrlParam_addr, u32 dataOutInfo_addr)
{
u32& fd = subHandle;
//Get size of file
u32 sb_addr = Memory.Alloc(52,1); // Alloc a CellFsStat struct
cellFsFstat(fd, sb_addr);
u64 fileSize = Memory.Read64(sb_addr+36); // Get CellFsStat.st_size
Memory.Free(sb_addr);
const u32& fd = ((CellGifDecSubHandle*)subHandle)->fd;
const u64& fileSize = ((CellGifDecSubHandle*)subHandle)->fileSize;
const CellGifDecInParam& inParam = ((CellGifDecSubHandle*)subHandle)->inParam; // (TODO: We should use the outParam)
//Copy the GIF file to a buffer
u32 buffer = Memory.Alloc(fileSize,1);
@ -163,24 +205,37 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, u32 data_addr, u32 dataC
return CELL_GIFDEC_ERROR_STREAM_FORMAT;
}
u32 image_size = width * height * 4;
for(u32 i = 0; i < image_size; i+=4){
Memory.Write8(data_addr+i+0, image[i+3]);
Memory.Write8(data_addr+i+1, image[i+0]);
Memory.Write8(data_addr+i+2, image[i+1]);
Memory.Write8(data_addr+i+3, image[i+2]);
if (inParam.colorSpace == CELL_GIFDEC_RGBA){
for(u32 i = 0; i < image_size; i+=4){
Memory.Write8(data_addr+i+0, image[i+0]);
Memory.Write8(data_addr+i+1, image[i+1]);
Memory.Write8(data_addr+i+2, image[i+2]);
Memory.Write8(data_addr+i+3, image[i+3]); // (This can be optimized by using Write32)
}
}
if (inParam.colorSpace == CELL_GIFDEC_ARGB){
for(u32 i = 0; i < image_size; i+=4){
Memory.Write8(data_addr+i+0, image[i+3]);
Memory.Write8(data_addr+i+1, image[i+0]);
Memory.Write8(data_addr+i+2, image[i+1]);
Memory.Write8(data_addr+i+3, image[i+2]);
}
}
Memory.Free(buffer);
//The output data is an image (dataOutInfo.recordType = 1)
Memory.Write32(dataOutInfo_addr, 1);
u32 outExtensionData_addr = Memory.Alloc(20,1); // (TODO: Is this the best way to avoid exceptions when trying to access this data? Will this produce a memory leak?)
Memory.Write32(dataOutInfo_addr+8, outExtensionData_addr);
return CELL_OK;
}
int cellGifDecClose(u32 mainHandle, u32 subHandle)
{
u32& fd = subHandle;
cellFsClose(fd);
cellFsClose( ((CellGifDecSubHandle*)subHandle)->fd );
delete (CellGifDecSubHandle*)subHandle;
return CELL_OK;
}

View File

@ -26,4 +26,15 @@ void sys_io_init()
sys_io.AddFunc(0x3f72c56e, cellKbSetLEDStatus);
sys_io.AddFunc(0xdeefdfa7, cellKbSetReadMode);
sys_io.AddFunc(0x1f71ecbe, cellKbGetConfiguration);
sys_io.AddFunc(0xc9030138, cellMouseInit);
sys_io.AddFunc(0x3ef66b95, cellMouseClearBuf);
sys_io.AddFunc(0xe10183ce, cellMouseEnd);
sys_io.AddFunc(0x5baf30fb, cellMouseGetInfo);
sys_io.AddFunc(0x4d0b3b1f, cellMouseInfoTabletMode);
sys_io.AddFunc(0x3138e632, cellMouseGetData);
sys_io.AddFunc(0x6bd131f0, cellMouseGetDataList);
sys_io.AddFunc(0x2d16da4f, cellMouseSetTabletMode);
sys_io.AddFunc(0x21a62e9b, cellMouseGetTabletDataList);
sys_io.AddFunc(0xa328cc35, cellMouseGetRawData);
}

View File

@ -228,6 +228,18 @@ extern int cellKbSetLEDStatus(u32 port_no, u8 led);
extern int cellKbSetReadMode(u32 port_no, u32 rmode);
extern int cellKbGetConfiguration(u32 port_no, u32 config_addr);
//cellMouse
extern int cellMouseInit(u32 max_connect);
extern int cellMouseClearBuf(u32 port_no);
extern int cellMouseEnd();
extern int cellMouseGetInfo(u32 info_addr);
extern int cellMouseInfoTabletMode(u32 port_no, u32 info_addr);
extern int cellMouseGetData(u32 port_no, u32 data_addr);
extern int cellMouseGetDataList(u32 port_no, u32 data_addr);
extern int cellMouseSetTabletMode(u32 port_no, u32 mode);
extern int cellMouseGetTabletDataList(u32 port_no, u32 data_addr);
extern int cellMouseGetRawData(u32 port_no, u32 data_addr);
//cellGcm
extern int cellGcmCallback(u32 context_addr, u32 count);

View File

@ -0,0 +1,142 @@
#include "stdafx.h"
#include "Emu/Io/Mouse.h"
#include "Emu/SysCalls/SysCalls.h"
extern Module sys_io;
enum CELL_MOUSE_ERROR_CODE
{
CELL_MOUSE_ERROR_FATAL = 0x80121201,
CELL_MOUSE_ERROR_INVALID_PARAMETER = 0x80121202,
CELL_MOUSE_ERROR_ALREADY_INITIALIZED = 0x80121203,
CELL_MOUSE_ERROR_UNINITIALIZED = 0x80121204,
CELL_MOUSE_ERROR_RESOURCE_ALLOCATION_FAILED = 0x80121205,
CELL_MOUSE_ERROR_DATA_READ_FAILED = 0x80121206,
CELL_MOUSE_ERROR_NO_DEVICE = 0x80121207,
CELL_MOUSE_ERROR_SYS_SETTING_FAILED = 0x80121208,
};
int cellMouseInit(u32 max_connect)
{
sys_io.Log("cellMouseInit(max_connect=%d)", max_connect);
if(Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_ALREADY_INITIALIZED;
if(max_connect > 7) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
Emu.GetMouseManager().Init(max_connect);
return CELL_OK;
}
int cellMouseClearBuf(u32 port_no)
{
sys_io.Log("cellMouseClearBuf(port_no=%d)", port_no);
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().GetCount()) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
//?
return CELL_OK;
}
int cellMouseEnd()
{
sys_io.Log("cellMouseEnd()");
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
Emu.GetMouseManager().Close();
return CELL_OK;
}
int cellMouseGetInfo(u32 info_addr)
{
sys_io.Log("cellMouseGetInfo(info_addr=0x%x)", info_addr);
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
const MouseInfo& current_info = Emu.GetMouseManager().GetInfo();
mem_class_t info(info_addr);
info += current_info.max_connect;
info += current_info.now_connect;
info += current_info.info;
for(u32 i=0; i<CELL_MAX_MICE; i++) info += current_info.vendor_id[i];
for(u32 i=0; i<CELL_MAX_MICE; i++) info += current_info.product_id[i];
for(u32 i=0; i<CELL_MAX_MICE; i++) info += current_info.status[i];
return CELL_OK;
}
int cellMouseInfoTabletMode(u32 port_no, u32 info_addr)
{
sys_io.Log("cellMouseInfoTabletMode(port_no=%d,info_addr=0x%x)", port_no,info_addr);
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().GetCount()) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
mem_class_t info(info_addr);
info += 0; // Unimplemented: (0=Tablet mode is not supported)
info += 1; // Unimplemented: (1=Mouse mode)
return CELL_OK;
}
int cellMouseGetData(u32 port_no, u32 data_addr)
{
sys_io.Log("cellMouseGetData(port_no=%d,data_addr=0x%x)", port_no,data_addr);
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().GetCount()) return CELL_MOUSE_ERROR_NO_DEVICE;
CellMouseData& current_data = Emu.GetMouseManager().GetData(port_no);
mem_class_t data(data_addr);
data += current_data.update;
data += current_data.buttons;
data += current_data.x_axis;
data += current_data.y_axis;
data += current_data.wheel;
data += current_data.tilt;
current_data.update = CELL_MOUSE_DATA_NON;
current_data.x_axis = 0;
current_data.y_axis = 0;
current_data.wheel = 0;
return CELL_OK;
}
int cellMouseGetDataList(u32 port_no, u32 data_addr)
{
UNIMPLEMENTED_FUNC(sys_io);
return CELL_OK;
}
int cellMouseSetTabletMode(u32 port_no, u32 mode)
{
UNIMPLEMENTED_FUNC(sys_io);
return CELL_OK;
}
int cellMouseGetTabletDataList(u32 port_no, u32 data_addr)
{
UNIMPLEMENTED_FUNC(sys_io);
return CELL_OK;
}
int cellMouseGetRawData(u32 port_no, u32 data_addr)
{
UNIMPLEMENTED_FUNC(sys_io);
/*sys_io.Log("cellMouseGetRawData(port_no=%d,data_addr=0x%x)", port_no,data_addr);
if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED;
if(port_no >= Emu.GetMouseManager().GetMice().GetCount()) return CELL_MOUSE_ERROR_NO_DEVICE;
CellMouseRawData& current_rawdata = Emu.GetMouseManager().GetRawData(port_no);
mem_class_t data(data_addr);
data += current_rawdata.len;
for(s32 i=0; i<current_rawdata.len; i++)
{
data += current_rawdata.data[i];
}
current_rawdata.len = 0;*/
return CELL_OK;
}

View File

@ -262,6 +262,7 @@ void Emulator::Stop()
GetIdManager().Clear();
GetPadManager().Close();
GetKeyboardManager().Close();
GetMouseManager().Close();
GetCallbackManager().Clear();
UnloadModules();

View File

@ -4,6 +4,7 @@
#include "Emu/Cell/PPCThreadManager.h"
#include "Emu/Io/Pad.h"
#include "Emu/Io/Keyboard.h"
#include "Emu/Io/Mouse.h"
#include "Emu/GS/GSManager.h"
#include "Emu/FS/VFS.h"
#include "Emu/DbgConsole.h"
@ -80,6 +81,7 @@ class Emulator
PPCThreadManager m_thread_manager;
PadManager m_pad_manager;
KeyboardManager m_keyboard_manager;
MouseManager m_mouse_manager;
IdManager m_id_manager;
DbgConsole* m_dbg_console;
GSManager m_gs_manager;
@ -99,6 +101,7 @@ public:
PPCThreadManager& GetCPU() { return m_thread_manager; }
PadManager& GetPadManager() { return m_pad_manager; }
KeyboardManager& GetKeyboardManager() { return m_keyboard_manager; }
MouseManager& GetMouseManager() { return m_mouse_manager; }
IdManager& GetIdManager() { return m_id_manager; }
DbgConsole& GetDbgCon() { return *m_dbg_console; }
GSManager& GetGSManager() { return m_gs_manager; }

View File

@ -289,6 +289,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
wxStaticBoxSizer* s_round_io( new wxStaticBoxSizer( wxVERTICAL, &diag, _("IO") ) );
wxStaticBoxSizer* s_round_pad_handler( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Pad Handler") ) );
wxStaticBoxSizer* s_round_keyboard_handler( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Keyboard Handler") ) );
wxStaticBoxSizer* s_round_mouse_handler( new wxStaticBoxSizer( wxVERTICAL, &diag, _("Mouse Handler") ) );
wxComboBox* cbox_cpu_decoder = new wxComboBox(&diag, wxID_ANY);
wxComboBox* cbox_gs_render = new wxComboBox(&diag, wxID_ANY);
@ -296,6 +297,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
wxComboBox* cbox_gs_aspect = new wxComboBox(&diag, wxID_ANY);
wxComboBox* cbox_pad_handler = new wxComboBox(&diag, wxID_ANY);
wxComboBox* cbox_keyboard_handler = new wxComboBox(&diag, wxID_ANY);
wxComboBox* cbox_mouse_handler = new wxComboBox(&diag, wxID_ANY);
wxCheckBox* chbox_gs_vsync = new wxCheckBox(&diag, wxID_ANY, "VSync");
@ -323,6 +325,10 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
cbox_keyboard_handler->Append("Windows");
//cbox_pad_handler->Append("DirectInput");
cbox_mouse_handler->Append("Null");
cbox_mouse_handler->Append("Windows");
//cbox_pad_handler->Append("DirectInput");
chbox_gs_vsync->SetValue(Ini.GSVSyncEnable.GetValue());
cbox_cpu_decoder->SetSelection(Ini.CPUDecoderMode.GetValue() ? Ini.CPUDecoderMode.GetValue() - 1 : 0);
@ -331,6 +337,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
cbox_gs_aspect->SetSelection(Ini.GSAspectRatio.GetValue() - 1);
cbox_pad_handler->SetSelection(Ini.PadHandlerMode.GetValue());
cbox_keyboard_handler->SetSelection(Ini.KeyboardHandlerMode.GetValue());
cbox_mouse_handler->SetSelection(Ini.MouseHandlerMode.GetValue());
s_round_cpu_decoder->Add(cbox_cpu_decoder, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_cpu->Add(s_round_cpu_decoder, wxSizerFlags().Border(wxALL, 5).Expand());
@ -345,8 +352,10 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
s_round_pad_handler->Add(cbox_pad_handler, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_keyboard_handler->Add(cbox_keyboard_handler, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_mouse_handler->Add(cbox_mouse_handler, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_io->Add(s_round_pad_handler, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_io->Add(s_round_keyboard_handler, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_io->Add(s_round_mouse_handler, wxSizerFlags().Border(wxALL, 5).Expand());
wxBoxSizer* s_b_panel(new wxBoxSizer(wxHORIZONTAL));
@ -360,7 +369,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
s_subpanel2->Add(s_round_io, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel1->Add(s_b_panel, wxSizerFlags().Border(wxALL, 8).Expand());
s_subpanel2->AddSpacer(200);
s_subpanel2->AddSpacer(180);
s_panel->Add(s_subpanel1, wxSizerFlags().Border(wxALL, 5).Expand());
s_panel->Add(s_subpanel2, wxSizerFlags().Border(wxALL, 5).Expand());
@ -375,6 +384,7 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
Ini.GSVSyncEnable.SetValue(chbox_gs_vsync->GetValue());
Ini.PadHandlerMode.SetValue(cbox_pad_handler->GetSelection());
Ini.KeyboardHandlerMode.SetValue(cbox_keyboard_handler->GetSelection());
Ini.MouseHandlerMode.SetValue(cbox_mouse_handler->GetSelection());
Ini.Save();
}

View File

@ -99,6 +99,7 @@ public:
IniEntry<bool> GSVSyncEnable;
IniEntry<u8> PadHandlerMode;
IniEntry<u8> KeyboardHandlerMode;
IniEntry<u8> MouseHandlerMode;
public:
Inis() : DefPath("EmuSettings")
@ -117,6 +118,7 @@ public:
path = DefPath + "\\" + "IO";
PadHandlerMode.Init("PadHandlerMode", path);
KeyboardHandlerMode.Init("KeyboardHandlerMode", path);
MouseHandlerMode.Init("MouseHandlerMode", path);
}
void Load()
@ -128,6 +130,7 @@ public:
GSVSyncEnable.Load(false);
PadHandlerMode.Load(0);
KeyboardHandlerMode.Load(0);
MouseHandlerMode.Load(0);
}
void Save()
@ -139,6 +142,7 @@ public:
GSVSyncEnable.Save();
PadHandlerMode.Save();
KeyboardHandlerMode.Save();
MouseHandlerMode.Save();
}
};

View File

@ -222,6 +222,7 @@
<ClCompile Include="Emu\GS\RSXThread.cpp" />
<ClCompile Include="Emu\HDD\HDD.cpp" />
<ClCompile Include="Emu\Io\Keyboard.cpp" />
<ClCompile Include="Emu\Io\Mouse.cpp" />
<ClCompile Include="Emu\Io\Pad.cpp" />
<ClCompile Include="Emu\Memory\Memory.cpp" />
<ClCompile Include="Emu\SysCalls\Callback.cpp" />
@ -234,6 +235,7 @@
<ClCompile Include="Emu\SysCalls\lv2\SC_Keyboard.cpp" />
<ClCompile Include="Emu\SysCalls\lv2\SC_Lwmutex.cpp" />
<ClCompile Include="Emu\SysCalls\lv2\SC_Memory.cpp" />
<ClCompile Include="Emu\SysCalls\lv2\SC_Mouse.cpp" />
<ClCompile Include="Emu\SysCalls\lv2\SC_Mutex.cpp" />
<ClCompile Include="Emu\SysCalls\lv2\SC_Pad.cpp" />
<ClCompile Include="Emu\SysCalls\lv2\SC_PPU_Thread.cpp" />

View File

@ -301,6 +301,12 @@
<ClCompile Include="Emu\SysCalls\lv2\SC_Keyboard.cpp">
<Filter>Emu\SysCalls\lv2</Filter>
</ClCompile>
<ClCompile Include="Emu\Io\Mouse.cpp">
<Filter>Emu\Io</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\lv2\SC_Mouse.cpp">
<Filter>Emu\SysCalls\lv2</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="rpcs3.rc" />