mirror of
https://github.com/holub/mame
synced 2025-04-28 19:14:55 +03:00
pty: seems ok (linux only)
This commit is contained in:
parent
f8cb153519
commit
898fc7b373
@ -194,6 +194,8 @@ files {
|
|||||||
MAME_DIR .. "src/emu/ui/imgcntrl.h",
|
MAME_DIR .. "src/emu/ui/imgcntrl.h",
|
||||||
MAME_DIR .. "src/emu/ui/info.c",
|
MAME_DIR .. "src/emu/ui/info.c",
|
||||||
MAME_DIR .. "src/emu/ui/info.h",
|
MAME_DIR .. "src/emu/ui/info.h",
|
||||||
|
MAME_DIR .. "src/emu/ui/info_pty.c",
|
||||||
|
MAME_DIR .. "src/emu/ui/info_pty.h",
|
||||||
MAME_DIR .. "src/emu/ui/inputmap.c",
|
MAME_DIR .. "src/emu/ui/inputmap.c",
|
||||||
MAME_DIR .. "src/emu/ui/inputmap.h",
|
MAME_DIR .. "src/emu/ui/inputmap.h",
|
||||||
MAME_DIR .. "src/emu/ui/selgame.c",
|
MAME_DIR .. "src/emu/ui/selgame.c",
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "pty.h"
|
#include "pty.h"
|
||||||
|
|
||||||
#define FU_TEST
|
|
||||||
|
|
||||||
static const int TIMER_POLL = 1;
|
static const int TIMER_POLL = 1;
|
||||||
|
|
||||||
pseudo_terminal_device::pseudo_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
pseudo_terminal_device::pseudo_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||||
@ -65,15 +63,12 @@ void pseudo_terminal_device::device_start()
|
|||||||
{
|
{
|
||||||
m_timer_poll = timer_alloc(TIMER_POLL);
|
m_timer_poll = timer_alloc(TIMER_POLL);
|
||||||
|
|
||||||
if (open()) {
|
open();
|
||||||
#ifdef FU_TEST
|
|
||||||
printf("slave PTY = %s\n" , slave_name());
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
#ifdef FU_TEST
|
|
||||||
puts("Opening PTY failed");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pseudo_terminal_device::device_stop()
|
||||||
|
{
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pseudo_terminal_device::device_reset()
|
void pseudo_terminal_device::device_reset()
|
||||||
@ -124,11 +119,6 @@ void pseudo_terminal_device::queue(void)
|
|||||||
} else {
|
} else {
|
||||||
m_input_count = 0;
|
m_input_count = 0;
|
||||||
}
|
}
|
||||||
#ifdef FU_TEST
|
|
||||||
if (m_input_count) {
|
|
||||||
printf("read %u\n" , m_input_count);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_input_count != 0)
|
if (m_input_count != 0)
|
||||||
|
@ -23,6 +23,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual ioport_constructor device_input_ports() const;
|
virtual ioport_constructor device_input_ports() const;
|
||||||
virtual void device_start();
|
virtual void device_start();
|
||||||
|
virtual void device_stop();
|
||||||
virtual void device_reset();
|
virtual void device_reset();
|
||||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||||
|
|
||||||
|
@ -48,6 +48,11 @@ void device_pty_interface::close(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool device_pty_interface::is_open(void) const
|
||||||
|
{
|
||||||
|
return m_opened;
|
||||||
|
}
|
||||||
|
|
||||||
ssize_t device_pty_interface::read(UINT8 *rx_chars , size_t count)
|
ssize_t device_pty_interface::read(UINT8 *rx_chars , size_t count)
|
||||||
{
|
{
|
||||||
UINT32 actual_bytes;
|
UINT32 actual_bytes;
|
||||||
|
@ -27,6 +27,8 @@ public:
|
|||||||
bool open(void);
|
bool open(void);
|
||||||
void close(void);
|
void close(void);
|
||||||
|
|
||||||
|
bool is_open(void) const;
|
||||||
|
|
||||||
ssize_t read(UINT8 *rx_chars , size_t count);
|
ssize_t read(UINT8 *rx_chars , size_t count);
|
||||||
void write(UINT8 tx_char);
|
void write(UINT8 tx_char);
|
||||||
|
|
||||||
|
44
src/emu/ui/info_pty.c
Normal file
44
src/emu/ui/info_pty.c
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:F.Ulivi
|
||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
ui/info_pty.c
|
||||||
|
|
||||||
|
Information screen on pseudo terminals
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "ui/menu.h"
|
||||||
|
#include "ui/info_pty.h"
|
||||||
|
|
||||||
|
ui_menu_pty_info::ui_menu_pty_info(running_machine &machine, render_container *container) :
|
||||||
|
ui_menu(machine, container)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_menu_pty_info::~ui_menu_pty_info()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_menu_pty_info::populate()
|
||||||
|
{
|
||||||
|
item_append("Pseudo terminals", NULL, MENU_FLAG_DISABLE, NULL);
|
||||||
|
item_append("", NULL, MENU_FLAG_DISABLE, NULL);
|
||||||
|
|
||||||
|
pty_interface_iterator iter(machine().root_device());
|
||||||
|
for (device_pty_interface *pty = iter.first(); pty != NULL; pty = iter.next()) {
|
||||||
|
const char *port_name = pty->device().owner()->tag() + 1;
|
||||||
|
if (pty->is_open()) {
|
||||||
|
item_append(port_name , pty->slave_name() , MENU_FLAG_DISABLE , NULL);
|
||||||
|
} else {
|
||||||
|
item_append(port_name , "[failed]" , MENU_FLAG_DISABLE , NULL);
|
||||||
|
}
|
||||||
|
item_append("", NULL, MENU_FLAG_DISABLE, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_menu_pty_info::handle()
|
||||||
|
{
|
||||||
|
process(0);
|
||||||
|
}
|
24
src/emu/ui/info_pty.h
Normal file
24
src/emu/ui/info_pty.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:F.Ulivi
|
||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
ui/info_pty.h
|
||||||
|
|
||||||
|
Information screen on pseudo terminals
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __UI_INFO_PTY_H__
|
||||||
|
#define __UI_INFO_PTY_H__
|
||||||
|
|
||||||
|
class ui_menu_pty_info : public ui_menu {
|
||||||
|
public:
|
||||||
|
ui_menu_pty_info(running_machine &machine, render_container *container);
|
||||||
|
virtual ~ui_menu_pty_info();
|
||||||
|
virtual void populate();
|
||||||
|
virtual void handle();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __UI_INFO_PTY_H__
|
@ -22,6 +22,7 @@
|
|||||||
#include "ui/barcode.h"
|
#include "ui/barcode.h"
|
||||||
#include "ui/cheatopt.h"
|
#include "ui/cheatopt.h"
|
||||||
#include "ui/info.h"
|
#include "ui/info.h"
|
||||||
|
#include "ui/info_pty.h"
|
||||||
#include "ui/inputmap.h"
|
#include "ui/inputmap.h"
|
||||||
#include "ui/mainmenu.h"
|
#include "ui/mainmenu.h"
|
||||||
#include "ui/miscmenu.h"
|
#include "ui/miscmenu.h"
|
||||||
@ -90,6 +91,10 @@ void ui_menu_main::populate()
|
|||||||
item_append("Tape Control", NULL, 0, (void *)TAPE_CONTROL);
|
item_append("Tape Control", NULL, 0, (void *)TAPE_CONTROL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pty_interface_iterator ptyiter(machine().root_device());
|
||||||
|
if (ptyiter.first() != NULL) {
|
||||||
|
item_append("Pseudo terminals", NULL, 0, (void *)PTY_INFO);
|
||||||
|
}
|
||||||
if (machine().ioport().has_bioses())
|
if (machine().ioport().has_bioses())
|
||||||
item_append("Bios Selection", NULL, 0, (void *)BIOS_SELECTION);
|
item_append("Bios Selection", NULL, 0, (void *)BIOS_SELECTION);
|
||||||
|
|
||||||
@ -191,6 +196,10 @@ void ui_menu_main::handle()
|
|||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_tape_control(machine(), container, NULL)));
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_tape_control(machine(), container, NULL)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PTY_INFO:
|
||||||
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_pty_info(machine(), container)));
|
||||||
|
break;
|
||||||
|
|
||||||
case SLOT_DEVICES:
|
case SLOT_DEVICES:
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_slot_devices(machine(), container)));
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_slot_devices(machine(), container)));
|
||||||
break;
|
break;
|
||||||
|
@ -44,7 +44,8 @@ private:
|
|||||||
CHEAT,
|
CHEAT,
|
||||||
SELECT_GAME,
|
SELECT_GAME,
|
||||||
BIOS_SELECTION,
|
BIOS_SELECTION,
|
||||||
BARCODE_READ
|
BARCODE_READ,
|
||||||
|
PTY_INFO
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user