1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00
This commit is contained in:
Nekotekina 2015-06-21 03:17:42 +03:00
parent bc9481db1b
commit 6c4148a949
11 changed files with 62 additions and 42 deletions

View File

@ -242,6 +242,17 @@ namespace fmt
}
};
template<typename T>
struct unveil<le_t<T>, false>
{
using result_type = typename unveil<T>::result_type;
force_inline static result_type get_value(const le_t<T>& arg)
{
return unveil<T>::get_value(arg.value());
}
};
template<typename T>
force_inline typename unveil<T>::result_type do_unveil(const T& arg)
{

View File

@ -109,6 +109,7 @@ enum x64_op_t : u32
X64OP_NONE,
X64OP_LOAD, // obtain and put the value into x64 register
X64OP_STORE, // take the value from x64 register or an immediate and use it
// example: add eax,[rax] -> X64OP_LOAD_ADD (add the value to x64 register)
// example: add [rax],eax -> X64OP_LOAD_ADD_STORE (this will probably never happen for MMIO registers)
@ -116,7 +117,7 @@ enum x64_op_t : u32
X64OP_STOS,
X64OP_XCHG,
X64OP_CMPXCHG,
X64OP_LOAD_AND_STORE,
X64OP_LOAD_AND_STORE, // lock and [mem],reg
};
void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, size_t& out_size, size_t& out_length)

View File

@ -79,6 +79,28 @@ struct SceVoiceBasePortInfo
struct SceVoicePortParam
{
// aux structs
struct _voice_t
{
le_t<s32> bitrate; // SceVoiceBitRate
};
struct _pcmaudio_t
{
using _format_t = SceVoicePCMFormat;
le_t<u32> bufSize;
_format_t format;
};
struct _device_t
{
le_t<u32> playerId;
};
// struct members
le_t<s32> portType; // SceVoicePortType
le_t<u16> threshold;
le_t<u16> bMute;
@ -86,29 +108,9 @@ struct SceVoicePortParam
union
{
struct _voice_t
{
le_t<s32> bitrate; // SceVoiceBitRate
};
_voice_t voice;
struct _pcmaudio_t
{
using _format_t = SceVoicePCMFormat;
le_t<u32> bufSize;
_format_t format;
};
_pcmaudio_t pcmaudio;
struct _device_t
{
le_t<u32> playerId;
};
_device_t device;
_voice_t voice;
};
};

View File

@ -764,9 +764,9 @@ cpu_thread& ppu_thread::args(std::initializer_list<std::string> values)
assert(argc == 0);
envp.set(vm::alloc(align(sizeof32(u64), stack_align), vm::main));
envp.set(vm::alloc(align(sizeof32(*envp), stack_align), vm::main));
*envp = 0;
argv.set(vm::alloc(sizeof32(u64) * (u32)values.size(), vm::main));
argv.set(vm::alloc(sizeof32(*argv) * (u32)values.size(), vm::main));
for (auto &arg : values)
{

View File

@ -106,7 +106,7 @@ s32 sys_cond_signal_all(u32 cond_id)
return CELL_ESRCH;
}
if (const u32 count = cond->waiters.size())
if (const u64 count = cond->waiters.size())
{
cond->signaled += count;
cond->waiters.clear();

View File

@ -22,7 +22,7 @@ struct lv2_cond_t
const u64 name;
const std::shared_ptr<lv2_mutex_t> mutex; // associated mutex
std::atomic<u32> signaled;
std::atomic<u64> signaled;
// TODO: use sleep queue, possibly remove condition variable
std::condition_variable cv;

View File

@ -118,8 +118,13 @@ s32 sys_event_queue_tryreceive(u32 equeue_id, vm::ptr<sys_event_t> event_array,
while (!queue->waiters && count < size && queue->events.size())
{
auto& dest = event_array[count++];
auto& event = queue->events.front();
event_array[count++] = { be_t<u64>::make(event.source), be_t<u64>::make(event.data1), be_t<u64>::make(event.data2), be_t<u64>::make(event.data3) };
dest.source = event.source;
dest.data1 = event.data1;
dest.data2 = event.data2;
dest.data3 = event.data3;
queue->events.pop_front();
}

View File

@ -131,7 +131,7 @@ s32 _sys_lwcond_signal_all(u32 lwcond_id, u32 lwmutex_id, u32 mode)
sys_lwcond.Error("_sys_lwcond_signal_all(%d): invalid mode (%d)", lwcond_id, mode);
}
const u32 count = cond->waiters.size();
const u32 count = (u32)cond->waiters.size();
if (count)
{

View File

@ -43,7 +43,7 @@ s32 sys_semaphore_create(vm::ptr<u32> sem, vm::ptr<sys_semaphore_attribute_t> at
return CELL_EINVAL;
}
*sem = Emu.GetIdManager().make<lv2_sema_t>(initial_val, max_val, protocol, attr->name_u64);
*sem = Emu.GetIdManager().make<lv2_sema_t>(protocol, max_val, attr->name_u64, initial_val);
return CELL_OK;
}

View File

@ -72,6 +72,8 @@ s32 sys_timer_destroy(u32 timer_id)
{
sys_timer.Warning("sys_timer_destroy(timer_id=0x%x)", timer_id);
LV2_LOCK;
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
if (!timer)
@ -79,8 +81,6 @@ s32 sys_timer_destroy(u32 timer_id)
return CELL_ESRCH;
}
LV2_LOCK;
if (!timer->port.expired())
{
return CELL_EISCONN;
@ -88,6 +88,8 @@ s32 sys_timer_destroy(u32 timer_id)
Emu.GetIdManager().remove<lv2_timer_t>(timer_id);
lv2_lock.unlock();
return CELL_OK;
}
@ -95,6 +97,8 @@ s32 sys_timer_get_information(u32 timer_id, vm::ptr<sys_timer_information_t> inf
{
sys_timer.Warning("sys_timer_get_information(timer_id=0x%x, info=*0x%x)", timer_id, info);
LV2_LOCK;
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
if (!timer)
@ -102,8 +106,6 @@ s32 sys_timer_get_information(u32 timer_id, vm::ptr<sys_timer_information_t> inf
return CELL_ESRCH;
}
LV2_LOCK;
info->next_expiration_time = timer->start;
info->period = timer->period;
@ -118,6 +120,8 @@ s32 _sys_timer_start(u32 timer_id, u64 base_time, u64 period)
const u64 start_time = get_system_time();
LV2_LOCK;
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
if (!timer)
@ -125,8 +129,6 @@ s32 _sys_timer_start(u32 timer_id, u64 base_time, u64 period)
return CELL_ESRCH;
}
LV2_LOCK;
if (timer->state != SYS_TIMER_STATE_STOP)
{
return CELL_EBUSY;
@ -170,6 +172,8 @@ s32 sys_timer_stop(u32 timer_id)
{
sys_timer.Warning("sys_timer_stop()");
LV2_LOCK;
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
if (!timer)
@ -177,8 +181,6 @@ s32 sys_timer_stop(u32 timer_id)
return CELL_ESRCH;
}
LV2_LOCK;
timer->state = SYS_TIMER_STATE_STOP; // stop timer
return CELL_OK;
@ -188,6 +190,8 @@ s32 sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data
{
sys_timer.Warning("sys_timer_connect_event_queue(timer_id=0x%x, queue_id=0x%x, name=0x%llx, data1=0x%llx, data2=0x%llx)", timer_id, queue_id, name, data1, data2);
LV2_LOCK;
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
const auto queue = Emu.GetIdManager().get<lv2_event_queue_t>(queue_id);
@ -196,8 +200,6 @@ s32 sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data
return CELL_ESRCH;
}
LV2_LOCK;
if (!timer->port.expired())
{
return CELL_EISCONN;
@ -215,6 +217,8 @@ s32 sys_timer_disconnect_event_queue(u32 timer_id)
{
sys_timer.Warning("sys_timer_disconnect_event_queue(timer_id=0x%x)", timer_id);
LV2_LOCK;
const auto timer = Emu.GetIdManager().get<lv2_timer_t>(timer_id);
if (!timer)
@ -222,8 +226,6 @@ s32 sys_timer_disconnect_event_queue(u32 timer_id)
return CELL_ESRCH;
}
LV2_LOCK;
if (timer->port.expired())
{
return CELL_ENOTCONN;

View File

@ -19,7 +19,6 @@ struct sys_timer_information_t
be_t<u32> pad;
};
// "timer_t" conflicts with some definition
struct lv2_timer_t
{
std::weak_ptr<lv2_event_queue_t> port; // event queue