2012-11-15 00:39:56 +01:00
|
|
|
#include "stdafx.h"
|
2014-06-02 19:27:24 +02:00
|
|
|
#include "Emu/Memory/Memory.h"
|
|
|
|
|
#include "Emu/System.h"
|
2012-11-15 00:39:56 +01:00
|
|
|
#include "Emu/SysCalls/SysCalls.h"
|
2014-08-23 16:51:51 +02:00
|
|
|
|
2014-07-06 01:30:28 +02:00
|
|
|
#include "sys_tty.h"
|
2012-11-15 00:39:56 +01:00
|
|
|
|
2014-08-23 16:51:51 +02:00
|
|
|
SysCallBase sys_tty("sys_tty");
|
|
|
|
|
|
2015-07-27 16:59:21 +02:00
|
|
|
s32 sys_tty_read(s32 ch, vm::ptr<char> buf, u32 len, vm::ptr<u32> preadlen)
|
2012-11-15 00:39:56 +01:00
|
|
|
{
|
2016-01-12 22:57:16 +01:00
|
|
|
sys_tty.todo("sys_tty_read(ch=%d, buf=*0x%x, len=%d, preadlen=*0x%x)", ch, buf, len, preadlen);
|
2014-08-23 16:51:51 +02:00
|
|
|
|
2014-07-06 18:05:52 +02:00
|
|
|
// We currently do not support reading from the Console
|
2014-09-03 18:33:30 +02:00
|
|
|
*preadlen = 0;
|
2014-02-16 09:28:32 +01:00
|
|
|
Emu.Pause();
|
2012-11-15 00:39:56 +01:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-27 16:59:21 +02:00
|
|
|
s32 sys_tty_write(s32 ch, vm::cptr<char> buf, u32 len, vm::ptr<u32> pwritelen)
|
2012-11-15 00:39:56 +01:00
|
|
|
{
|
2016-01-12 22:57:16 +01:00
|
|
|
sys_tty.notice("sys_tty_write(ch=%d, buf=*0x%x, len=%d, pwritelen=*0x%x)", ch, buf, len, pwritelen);
|
2014-08-23 16:51:51 +02:00
|
|
|
|
2015-07-09 19:19:29 +02:00
|
|
|
if (ch > 15)
|
|
|
|
|
{
|
|
|
|
|
return CELL_EINVAL;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-27 16:59:21 +02:00
|
|
|
if ((s32)len <= 0)
|
2015-07-09 19:19:29 +02:00
|
|
|
{
|
2015-07-27 16:59:21 +02:00
|
|
|
*pwritelen = 0;
|
|
|
|
|
|
2015-07-09 19:19:29 +02:00
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
2014-09-03 18:33:30 +02:00
|
|
|
|
2016-01-12 22:57:16 +01:00
|
|
|
_log::g_tty_file.log({ buf.get_ptr(), len });
|
|
|
|
|
|
2015-07-27 16:59:21 +02:00
|
|
|
*pwritelen = len;
|
|
|
|
|
|
2012-11-15 00:39:56 +01:00
|
|
|
return CELL_OK;
|
2013-06-30 10:46:29 +02:00
|
|
|
}
|