mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
add cellPadFilter functions
This commit is contained in:
parent
29c77132cb
commit
278050f8d0
2 changed files with 61 additions and 1 deletions
|
@ -31,6 +31,20 @@ void fmt_class_string<CellPadError>::format(std::string& out, u64 arg)
|
|||
});
|
||||
}
|
||||
|
||||
template<>
|
||||
void fmt_class_string<CellPadFilterError>::format(std::string& out, u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](auto error)
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
STR_CASE(CELL_PADFILTER_ERROR_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
return unknown;
|
||||
});
|
||||
}
|
||||
|
||||
error_code cellPadInit(u32 max_connect)
|
||||
{
|
||||
sys_io.warning("cellPadInit(max_connect=%d)", max_connect);
|
||||
|
@ -989,6 +1003,27 @@ error_code cellPadLddUnregisterController(s32 handle)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellPadFilterIIRInit(vm::ptr<CellPadFilterIIRSos> pSos, s32 cutoff)
|
||||
{
|
||||
sys_io.todo("cellPadFilterIIRInit(pSos=*0x%x, cutoff=%d)", pSos, cutoff);
|
||||
|
||||
if (!pSos) // TODO: does this check for cutoff > 2 ?
|
||||
{
|
||||
return CELL_PADFILTER_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
u32 cellPadFilterIIRFilter(vm::ptr<CellPadFilterIIRSos> pSos, u32 filterIn)
|
||||
{
|
||||
sys_io.todo("cellPadFilterIIRFilter(pSos=*0x%x, filterIn=%d)", pSos, filterIn);
|
||||
|
||||
// TODO: apply filter
|
||||
|
||||
return std::clamp(filterIn, 0u, 1023u);
|
||||
}
|
||||
|
||||
s32 sys_io_3733EA3C(u32 port_no, vm::ptr<u32> device_type, vm::ptr<CellPadData> data)
|
||||
{
|
||||
// Used by the ps1 emulator built into the firmware
|
||||
|
@ -1021,5 +1056,8 @@ void cellPad_init()
|
|||
REG_FUNC(sys_io, cellPadLddGetPortNo);
|
||||
REG_FUNC(sys_io, cellPadLddUnregisterController);
|
||||
|
||||
REG_FUNC(sys_io, cellPadFilterIIRInit);
|
||||
REG_FUNC(sys_io, cellPadFilterIIRFilter);
|
||||
|
||||
REG_FNID(sys_io, 0x3733EA3C, sys_io_3733EA3C);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "Emu/Io/PadHandler.h"
|
||||
#include "Utilities/BEType.h"
|
||||
|
@ -18,6 +18,11 @@ enum CellPadError : u32
|
|||
CELL_PAD_ERROR_EBUSY = 0x8012110a,
|
||||
};
|
||||
|
||||
enum CellPadFilterError : u32
|
||||
{
|
||||
CELL_PADFILTER_ERROR_INVALID_PARAMETER = 0x80121401,
|
||||
};
|
||||
|
||||
// Controller types
|
||||
enum
|
||||
{
|
||||
|
@ -38,6 +43,13 @@ enum
|
|||
CELL_PAD_LEN_CHANGE_SENSOR_ON = 24,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CELL_PADFILTER_IIR_CUTOFF_2ND_LPF_BT_050 = 0, // 50% Nyquist frequency
|
||||
CELL_PADFILTER_IIR_CUTOFF_2ND_LPF_BT_020 = 1, // 20% Nyquist frequency
|
||||
CELL_PADFILTER_IIR_CUTOFF_2ND_LPF_BT_010 = 2, // 10% Nyquist frequency
|
||||
};
|
||||
|
||||
struct CellPadData
|
||||
{
|
||||
be_t<s32> len;
|
||||
|
@ -96,6 +108,16 @@ struct CellPadActParam
|
|||
u8 reserved[6];
|
||||
};
|
||||
|
||||
struct CellPadFilterIIRSos
|
||||
{
|
||||
be_t<s32> u[3];
|
||||
be_t<s32> a1;
|
||||
be_t<s32> a2;
|
||||
be_t<s32> b0;
|
||||
be_t<s32> b1;
|
||||
be_t<s32> b2;
|
||||
};
|
||||
|
||||
struct pad_info
|
||||
{
|
||||
atomic_t<u32> max_connect = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue