Partial commit: sys_tty

This commit is contained in:
Nekotekina 2016-05-25 13:55:14 +03:00
parent c95f6c8c56
commit f5e65e4ad9
2 changed files with 11 additions and 14 deletions

View File

@ -1,25 +1,21 @@
#include "stdafx.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "Emu/Cell/ErrorCodes.h"
#include "sys_tty.h"
namespace vm { using namespace ps3; }
logs::channel sys_tty("sys_tty", logs::level::notice);
extern fs::file g_tty;
s32 sys_tty_read(s32 ch, vm::ptr<char> buf, u32 len, vm::ptr<u32> preadlen)
ppu_error_code sys_tty_read(s32 ch, vm::ptr<char> buf, u32 len, vm::ptr<u32> preadlen)
{
sys_tty.todo("sys_tty_read(ch=%d, buf=*0x%x, len=%d, preadlen=*0x%x)", ch, buf, len, preadlen);
sys_tty.fatal("sys_tty_read(ch=%d, buf=*0x%x, len=%d, preadlen=*0x%x)", ch, buf, len, preadlen);
// We currently do not support reading from the Console
*preadlen = 0;
Emu.Pause();
return CELL_OK;
throw std::runtime_error("Unimplemented" HERE);
}
s32 sys_tty_write(s32 ch, vm::cptr<char> buf, u32 len, vm::ptr<u32> pwritelen)
ppu_error_code sys_tty_write(s32 ch, vm::cptr<char> buf, u32 len, vm::ptr<u32> pwritelen)
{
sys_tty.notice("sys_tty_write(ch=%d, buf=*0x%x, len=%d, pwritelen=*0x%x)", ch, buf, len, pwritelen);
@ -28,7 +24,7 @@ s32 sys_tty_write(s32 ch, vm::cptr<char> buf, u32 len, vm::ptr<u32> pwritelen)
return CELL_EINVAL;
}
if ((s32)len <= 0)
if (static_cast<s32>(len) <= 0)
{
*pwritelen = 0;

View File

@ -1,6 +1,7 @@
#pragma once
namespace vm { using namespace ps3; }
#include "Emu/Memory/Memory.h"
#include "Emu/Cell/ErrorCodes.h"
// TTY channels
enum
@ -25,5 +26,5 @@ enum
};
// SysCalls
s32 sys_tty_read(s32 ch, vm::ptr<char> buf, u32 len, vm::ptr<u32> preadlen);
s32 sys_tty_write(s32 ch, vm::cptr<char> buf, u32 len, vm::ptr<u32> pwritelen);
ppu_error_code sys_tty_read(s32 ch, vm::ps3::ptr<char> buf, u32 len, vm::ps3::ptr<u32> preadlen);
ppu_error_code sys_tty_write(s32 ch, vm::ps3::cptr<char> buf, u32 len, vm::ps3::ptr<u32> pwritelen);