mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 06:47:45 -04:00
tweaking pandora frontend
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@874 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
0c9ae59222
commit
f6eaae4f09
16 changed files with 378 additions and 144 deletions
|
@ -95,9 +95,9 @@ int vout_fbdev_init(int *w, int *h)
|
|||
fbdev_mem_size = *w * *h * 2 * fbdev_buffer_count;
|
||||
fbdev_mem = mmap(0, fbdev_mem_size, PROT_WRITE|PROT_READ, MAP_SHARED, fbdev, 0);
|
||||
if (fbdev_mem == MAP_FAILED && fbdev_buffer_count > 1) {
|
||||
fprintf(stderr, "Warning: can't map %d bytes, doublebuffering disabled\n", fbdev_mem_size);
|
||||
fbdev_mem_size = *w * *h * 2;
|
||||
fbdev_buffer_count = 1;
|
||||
fprintf(stderr, "Warning: can't map %d bytes, doublebuffering disabled\n", fbdev_mem_size);
|
||||
fbdev_mem = mmap(0, fbdev_mem_size, PROT_WRITE|PROT_READ, MAP_SHARED, fbdev, 0);
|
||||
}
|
||||
if (fbdev_mem == MAP_FAILED) {
|
||||
|
|
|
@ -411,20 +411,20 @@ static const struct {
|
|||
{ KEY_LEFT, PBTN_LEFT },
|
||||
{ KEY_RIGHT, PBTN_RIGHT },
|
||||
{ KEY_ENTER, PBTN_MOK },
|
||||
{ KEY_KP2, PBTN_MOK },
|
||||
{ KEY_END, PBTN_MOK },
|
||||
{ BTN_TRIGGER, PBTN_MOK },
|
||||
{ KEY_ESC, PBTN_MBACK },
|
||||
{ KEY_KP3, PBTN_MBACK },
|
||||
{ KEY_PAGEDOWN, PBTN_MBACK },
|
||||
{ BTN_THUMB, PBTN_MBACK },
|
||||
{ KEY_A, PBTN_MA2 },
|
||||
{ KEY_KP4, PBTN_MA2 },
|
||||
{ KEY_HOME, PBTN_MA2 },
|
||||
{ KEY_S, PBTN_MA3 },
|
||||
{ KEY_KP1, PBTN_MA3 },
|
||||
{ KEY_PAGEUP, PBTN_MA3 },
|
||||
{ KEY_BACKSLASH, PBTN_MENU },
|
||||
{ KEY_LEFTCTRL, PBTN_MENU },
|
||||
{ BTN_TL, PBTN_L },
|
||||
{ KEY_RIGHTSHIFT, PBTN_L },
|
||||
{ KEY_LEFTBRACE, PBTN_L },
|
||||
{ BTN_TR, PBTN_R },
|
||||
{ KEY_RIGHTCTRL, PBTN_R },
|
||||
{ KEY_RIGHTBRACE, PBTN_R },
|
||||
};
|
||||
|
||||
|
@ -487,16 +487,16 @@ static const struct {
|
|||
{ KEY_LEFT, IN_BINDTYPE_PLAYER12, 2 },
|
||||
{ KEY_RIGHT, IN_BINDTYPE_PLAYER12, 3 },
|
||||
{ KEY_S, IN_BINDTYPE_PLAYER12, 4 }, /* B */
|
||||
{ KEY_KP3, IN_BINDTYPE_PLAYER12, 4 },
|
||||
{ KEY_PAGEDOWN, IN_BINDTYPE_PLAYER12, 4 },
|
||||
{ KEY_D, IN_BINDTYPE_PLAYER12, 5 }, /* C */
|
||||
{ KEY_KP2, IN_BINDTYPE_PLAYER12, 5 },
|
||||
{ KEY_END, IN_BINDTYPE_PLAYER12, 5 },
|
||||
{ KEY_A, IN_BINDTYPE_PLAYER12, 6 }, /* A */
|
||||
{ KEY_KP4, IN_BINDTYPE_PLAYER12, 6 },
|
||||
{ KEY_HOME, IN_BINDTYPE_PLAYER12, 6 },
|
||||
{ KEY_ENTER, IN_BINDTYPE_PLAYER12, 7 },
|
||||
{ KEY_LEFTALT, IN_BINDTYPE_PLAYER12, 7 },
|
||||
{ BTN_TL, IN_BINDTYPE_EMU, PEVB_STATE_LOAD },
|
||||
{ BTN_TR, IN_BINDTYPE_EMU, PEVB_STATE_SAVE },
|
||||
{ KEY_LEFTCTRL, IN_BINDTYPE_EMU, PEVB_MENU },
|
||||
{ KEY_RIGHTSHIFT,IN_BINDTYPE_EMU, PEVB_STATE_SAVE },
|
||||
{ KEY_RIGHTCTRL, IN_BINDTYPE_EMU, PEVB_STATE_LOAD },
|
||||
{ KEY_LEFTCTRL, IN_BINDTYPE_EMU, PEVB_MENU },
|
||||
};
|
||||
|
||||
#define DEF_BIND_COUNT (sizeof(in_evdev_def_binds) / sizeof(in_evdev_def_binds[0]))
|
||||
|
|
|
@ -1,10 +1,22 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#include <linux/kd.h>
|
||||
|
||||
#define PFX "oshide: "
|
||||
#define TERMIOS_DUMP_FILE "/tmp/pico_tios"
|
||||
|
||||
#define FPTR(f) typeof(f) * p##f
|
||||
#define FPTR_LINK(xf, dl, f) { \
|
||||
xf.p##f = dlsym(dl, #f); \
|
||||
|
@ -92,13 +104,9 @@ static void *x11h_handler(void *arg)
|
|||
|
||||
visual = DefaultVisual(display, 0);
|
||||
if (visual->class != TrueColor)
|
||||
{
|
||||
fprintf(stderr, "cannot handle non true color visual\n");
|
||||
xf.pXCloseDisplay(display);
|
||||
goto fail2;
|
||||
}
|
||||
fprintf(stderr, PFX "warning: non true color visual\n");
|
||||
|
||||
printf("x11h: X vendor: %s, rel: %d, display: %s, protocol ver: %d.%d\n", ServerVendor(display),
|
||||
printf(PFX "X vendor: %s, rel: %d, display: %s, protocol ver: %d.%d\n", ServerVendor(display),
|
||||
VendorRelease(display), DisplayString(display), ProtocolVersion(display),
|
||||
ProtocolRevision(display));
|
||||
|
||||
|
@ -106,7 +114,7 @@ static void *x11h_handler(void *arg)
|
|||
|
||||
display_width = DisplayWidth(display, screen);
|
||||
display_height = DisplayHeight(display, screen);
|
||||
printf("x11h: display is %dx%d\n", display_width, display_height);
|
||||
printf(PFX "display is %dx%d\n", display_width, display_height);
|
||||
|
||||
win = xf.pXCreateSimpleWindow(display,
|
||||
RootWindow(display, screen),
|
||||
|
@ -155,21 +163,103 @@ fail:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int x11h_init(void)
|
||||
static struct termios g_kbd_termios_saved;
|
||||
static int g_kbdfd;
|
||||
|
||||
static void hidecon_start(void)
|
||||
{
|
||||
struct termios kbd_termios;
|
||||
FILE *tios_f;
|
||||
int mode;
|
||||
|
||||
g_kbdfd = open("/dev/tty", O_RDWR);
|
||||
if (g_kbdfd == -1) {
|
||||
perror(PFX "open /dev/tty");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ioctl(g_kbdfd, KDGETMODE, &mode) == -1) {
|
||||
perror(PFX "(not hiding FB): KDGETMODE");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (tcgetattr(g_kbdfd, &kbd_termios) == -1) {
|
||||
perror(PFX "tcgetattr");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* dump for picorestore */
|
||||
g_kbd_termios_saved = kbd_termios;
|
||||
tios_f = fopen(TERMIOS_DUMP_FILE, "wb");
|
||||
if (tios_f) {
|
||||
fwrite(&kbd_termios, sizeof(kbd_termios), 1, tios_f);
|
||||
fclose(tios_f);
|
||||
}
|
||||
|
||||
kbd_termios.c_lflag &= ~(ICANON | ECHO); // | ISIG);
|
||||
kbd_termios.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON);
|
||||
kbd_termios.c_cc[VMIN] = 0;
|
||||
kbd_termios.c_cc[VTIME] = 0;
|
||||
|
||||
if (tcsetattr(g_kbdfd, TCSAFLUSH, &kbd_termios) == -1) {
|
||||
perror(PFX "tcsetattr");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (ioctl(g_kbdfd, KDSETMODE, KD_GRAPHICS) == -1) {
|
||||
perror(PFX "KDSETMODE KD_GRAPHICS");
|
||||
tcsetattr(g_kbdfd, TCSAFLUSH, &g_kbd_termios_saved);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
fail:
|
||||
close(g_kbdfd);
|
||||
g_kbdfd = -1;
|
||||
}
|
||||
|
||||
static void hidecon_end(void)
|
||||
{
|
||||
if (g_kbdfd < 0)
|
||||
return;
|
||||
|
||||
if (ioctl(g_kbdfd, KDSETMODE, KD_TEXT) == -1)
|
||||
perror(PFX "KDSETMODE KD_TEXT");
|
||||
|
||||
if (tcsetattr(g_kbdfd, TCSAFLUSH, &g_kbd_termios_saved) == -1)
|
||||
perror(PFX "tcsetattr");
|
||||
|
||||
remove(TERMIOS_DUMP_FILE);
|
||||
|
||||
close(g_kbdfd);
|
||||
g_kbdfd = -1;
|
||||
}
|
||||
|
||||
int oshide_init(void)
|
||||
{
|
||||
pthread_t tid;
|
||||
int ret;
|
||||
|
||||
ret = pthread_create(&tid, NULL, x11h_handler, NULL);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "x11h: failed to create thread: %d\n", ret);
|
||||
fprintf(stderr, PFX "failed to create thread: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
pthread_detach(tid);
|
||||
|
||||
hidecon_start();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void oshide_finish(void)
|
||||
{
|
||||
/* XXX: the X thread.. */
|
||||
|
||||
hidecon_end();
|
||||
}
|
||||
|
||||
#if 0
|
||||
int main()
|
||||
{
|
3
linux/oshide.h
Normal file
3
linux/oshide.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
int oshide_init(void);
|
||||
void oshide_finish(void);
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
int x11h_init(void);
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue