mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 16:20:27 +00:00
misc. fixes
add ctrl+c handler to linuxraw_input
This commit is contained in:
parent
3e1b621e7a
commit
ed14c8c6b8
28
gfx/rpi.c
28
gfx/rpi.c
@ -14,7 +14,6 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <bcm_host.h>
|
#include <bcm_host.h>
|
||||||
@ -24,9 +23,7 @@
|
|||||||
#include <EGL/eglext.h>
|
#include <EGL/eglext.h>
|
||||||
#include "../libretro.h"
|
#include "../libretro.h"
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
//#include "../input/linuxraw_input.h"
|
#include "../input/linuxraw_input.h"
|
||||||
// SDL include messing with some defines
|
|
||||||
typedef struct linuxraw_input linuxraw_input_t;
|
|
||||||
#include "../driver.h"
|
#include "../driver.h"
|
||||||
|
|
||||||
#ifdef HAVE_FREETYPE
|
#ifdef HAVE_FREETYPE
|
||||||
@ -113,24 +110,24 @@ static void *rpi_init(const video_info_t *video, const input_driver_t **input, v
|
|||||||
|
|
||||||
// get an EGL display connection
|
// get an EGL display connection
|
||||||
rpi->mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
rpi->mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
assert(rpi->mDisplay != EGL_NO_DISPLAY);
|
rarch_assert(rpi->mDisplay != EGL_NO_DISPLAY);
|
||||||
|
|
||||||
// initialize the EGL display connection
|
// initialize the EGL display connection
|
||||||
result = eglInitialize(rpi->mDisplay, NULL, NULL);
|
result = eglInitialize(rpi->mDisplay, NULL, NULL);
|
||||||
assert(result != EGL_FALSE);
|
rarch_assert(result != EGL_FALSE);
|
||||||
eglBindAPI(EGL_OPENVG_API);
|
eglBindAPI(EGL_OPENVG_API);
|
||||||
|
|
||||||
// get an appropriate EGL frame buffer configuration
|
// get an appropriate EGL frame buffer configuration
|
||||||
result = eglChooseConfig(rpi->mDisplay, attribute_list, &config, 1, &num_config);
|
result = eglChooseConfig(rpi->mDisplay, attribute_list, &config, 1, &num_config);
|
||||||
assert(result != EGL_FALSE);
|
rarch_assert(result != EGL_FALSE);
|
||||||
|
|
||||||
// create an EGL rendering context
|
// create an EGL rendering context
|
||||||
rpi->mContext = eglCreateContext(rpi->mDisplay, config, EGL_NO_CONTEXT, NULL);
|
rpi->mContext = eglCreateContext(rpi->mDisplay, config, EGL_NO_CONTEXT, NULL);
|
||||||
assert(rpi->mContext != EGL_NO_CONTEXT);
|
rarch_assert(rpi->mContext != EGL_NO_CONTEXT);
|
||||||
|
|
||||||
// create an EGL window surface
|
// create an EGL window surface
|
||||||
success = graphics_get_display_size(0 /* LCD */, &rpi->mScreenWidth, &rpi->mScreenHeight);
|
success = graphics_get_display_size(0 /* LCD */, &rpi->mScreenWidth, &rpi->mScreenHeight);
|
||||||
assert(success >= 0);
|
rarch_assert(success >= 0);
|
||||||
|
|
||||||
dst_rect.x = 0;
|
dst_rect.x = 0;
|
||||||
dst_rect.y = 0;
|
dst_rect.y = 0;
|
||||||
@ -156,11 +153,11 @@ static void *rpi_init(const video_info_t *video, const input_driver_t **input, v
|
|||||||
vc_dispmanx_update_submit_sync(dispman_update);
|
vc_dispmanx_update_submit_sync(dispman_update);
|
||||||
|
|
||||||
rpi->mSurface = eglCreateWindowSurface(rpi->mDisplay, config, &nativewindow, NULL);
|
rpi->mSurface = eglCreateWindowSurface(rpi->mDisplay, config, &nativewindow, NULL);
|
||||||
assert(rpi->mSurface != EGL_NO_SURFACE);
|
rarch_assert(rpi->mSurface != EGL_NO_SURFACE);
|
||||||
|
|
||||||
// connect the context to the surface
|
// connect the context to the surface
|
||||||
result = eglMakeCurrent(rpi->mDisplay, rpi->mSurface, rpi->mSurface, rpi->mContext);
|
result = eglMakeCurrent(rpi->mDisplay, rpi->mSurface, rpi->mSurface, rpi->mContext);
|
||||||
assert(result != EGL_FALSE);
|
rarch_assert(result != EGL_FALSE);
|
||||||
|
|
||||||
rpi->mTexType = video->rgb32 ? VG_sABGR_8888 : VG_sARGB_1555;
|
rpi->mTexType = video->rgb32 ? VG_sABGR_8888 : VG_sARGB_1555;
|
||||||
rpi->mKeepAspect = video->force_aspect;
|
rpi->mKeepAspect = video->force_aspect;
|
||||||
@ -426,12 +423,6 @@ static bool rpi_focus(void *data)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rpi_set_rotation(void *data, unsigned rotation)
|
|
||||||
{
|
|
||||||
(void)data;
|
|
||||||
(void)rotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
const video_driver_t video_rpi = {
|
const video_driver_t video_rpi = {
|
||||||
rpi_init,
|
rpi_init,
|
||||||
rpi_frame,
|
rpi_frame,
|
||||||
@ -440,6 +431,5 @@ const video_driver_t video_rpi = {
|
|||||||
rpi_focus,
|
rpi_focus,
|
||||||
NULL,
|
NULL,
|
||||||
rpi_free,
|
rpi_free,
|
||||||
"rpi",
|
"rpi"
|
||||||
rpi_set_rotation,
|
|
||||||
};
|
};
|
||||||
|
@ -278,7 +278,7 @@ static void linuxraw_input_poll(void *data)
|
|||||||
uint8_t c;
|
uint8_t c;
|
||||||
uint16_t t;
|
uint16_t t;
|
||||||
|
|
||||||
while (read(0, &c, 1))
|
while (read(0, &c, 1) > 0)
|
||||||
{
|
{
|
||||||
bool pressed = !(c & 0x80);
|
bool pressed = !(c & 0x80);
|
||||||
c &= ~0x80;
|
c &= ~0x80;
|
||||||
@ -286,10 +286,13 @@ static void linuxraw_input_poll(void *data)
|
|||||||
// ignore extended scancodes
|
// ignore extended scancodes
|
||||||
if (!c)
|
if (!c)
|
||||||
read(0, &t, 2);
|
read(0, &t, 2);
|
||||||
|
else
|
||||||
linuxraw->state[c] = pressed;
|
linuxraw->state[c] = pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (linuxraw->state[KEY_C] && (linuxraw->state[KEY_LEFTCTRL] || linuxraw->state[KEY_RIGHTCTRL]))
|
||||||
|
kill(getpid(), SIGINT);
|
||||||
|
|
||||||
input_sdl.poll(linuxraw->sdl);
|
input_sdl.poll(linuxraw->sdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../general.h"
|
|
||||||
#include "rarch_sdl_input.h"
|
|
||||||
|
|
||||||
#ifndef _LINUXRAW_INPUT_H
|
#ifndef _LINUXRAW_INPUT_H
|
||||||
#define _LINUXRAW_INPUT_H
|
#define _LINUXRAW_INPUT_H
|
||||||
|
|
||||||
|
#include "../general.h"
|
||||||
|
#include "rarch_sdl_input.h"
|
||||||
|
|
||||||
typedef struct linuxraw_input
|
typedef struct linuxraw_input
|
||||||
{
|
{
|
||||||
sdl_input_t *sdl;
|
sdl_input_t *sdl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user