Skip to content

Commit 2b93e5c

Browse files
committed
Added: Configuration of Keyboard and Gamepad by GUI.
1 parent 67a3e8c commit 2b93e5c

File tree

11 files changed

+760
-708
lines changed

11 files changed

+760
-708
lines changed

gui.c

+237-36
Large diffs are not rendered by default.

input.c

+225-112
Large diffs are not rendered by default.

input.h

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ typedef enum
7575
CURSOR_NONE
7676
} gui_action_type;
7777

78+
#ifdef RPI_BUILD
79+
extern u32 menu_hotkey;
80+
#endif
81+
7882
void init_input();
7983
u32 update_input();
8084
gui_action_type get_gui_input();
@@ -83,6 +87,7 @@ void input_write_mem_savestate(file_tag_type savestate_file);
8387
void input_read_savestate(file_tag_type savestate_file);
8488

8589
extern u32 gamepad_config_map[];
90+
extern u32 keyboard_config_map[];
8691
extern u32 global_enable_analog;
8792
extern u32 analog_sensitivity_level;
8893

raspberrypi/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ CFLAGS += -DARM_ARCH -DRPI_BUILD -Wall
2020
CFLAGS += -O3 -mfpu=vfp
2121
CFLAGS += `sdl-config --cflags`
2222
CFLAGS += -I$(SDKSTAGE)/opt/vc/include -I$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads
23-
CFLAGS += -I/opt/vc/include/interface/vmcs_host/linux
23+
CFLAGS += -I$(SDKSTAGE)/opt/vc/include/interface/vmcs_host/linux
2424

2525
# expecting to have PATH set up to get correct sdl-config first
2626

raspberrypi/gles_video.c

+26-39
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
/*
2-
3-
This file is based on Portable ZX-Spectrum emulator.
4-
Copyright (C) 2001-2012 SMT, Dexus, Alone Coder, deathsoft, djdron, scor
5-
6-
C++ to C code conversion by Pate
7-
8-
Modified by DPR for gpsp for Raspberry Pi
9-
10-
This program is free software: you can redistribute it and/or modify
11-
it under the terms of the GNU General Public License as published by
12-
the Free Software Foundation, either version 3 of the License, or
13-
(at your option) any later version.
14-
15-
This program is distributed in the hope that it will be useful,
16-
but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-
GNU General Public License for more details.
19-
20-
You should have received a copy of the GNU General Public License
21-
along with this program. If not, see <http://www.gnu.org/licenses/>.
22-
23-
*/
1+
/*
2+
*
3+
* This file is based on Portable ZX-Spectrum emulator.
4+
* Copyright (C) 2001-2012 SMT, Dexus, Alone Coder, deathsoft, djdron, scor
5+
*
6+
* C++ to C code conversion by Pate
7+
*
8+
* Modified by DPR for gpsp for Raspberry Pi
9+
*
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
*
23+
*/
2424

2525
#include "bcm_host.h"
2626
#include "GLES/gl.h"
@@ -57,16 +57,8 @@ static const char* fragment_shader =
5757
"void main() \n"
5858
"{ \n"
5959
" gl_FragColor = texture2D(u_texture, v_texcoord); \n"
60-
"} \n";
61-
/*
62-
static const GLfloat vertices[] =
63-
{
64-
-0.5f, -0.5f, 0.0f,
65-
+0.5f, -0.5f, 0.0f,
66-
+0.5f, +0.5f, 0.0f,
67-
-0.5f, +0.5f, 0.0f,
68-
};
69-
*/
60+
"} \n";
61+
7062
static const GLfloat vertices[] =
7163
{
7264
-0.5f, -0.5f, 0.0f,
@@ -259,8 +251,6 @@ void video_init(uint32_t _width, uint32_t _height, uint32_t filter)
259251

260252
frame_width = _width;
261253
frame_height = _height;
262-
263-
//bcm_host_init();
264254

265255
// get an EGL display connection
266256
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
@@ -364,7 +354,6 @@ static void SetOrtho(GLfloat m[4][4], GLfloat left, GLfloat right, GLfloat botto
364354
m[3][2] = -(far + near)/(far - near);
365355
m[3][3] = 1;
366356
}
367-
#define RGB15(r, g, b) (((r) << (5+6)) | ((g) << 6) | (b))
368357

369358
static void gles2_Draw( uint16_t *pixels)
370359
{
@@ -375,7 +364,7 @@ static void gles2_Draw( uint16_t *pixels)
375364

376365
glUseProgram(shader.program);
377366

378-
glBindTexture(GL_TEXTURE_2D, textures[0]);
367+
glBindTexture(GL_TEXTURE_2D, textures[0]);
379368
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, frame_width, frame_height, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, pixels);
380369
glActiveTexture(GL_TEXTURE0);
381370
glUniform1i(shader.u_texture, 0);
@@ -397,13 +386,11 @@ static void gles2_Draw( uint16_t *pixels)
397386

398387
glBindBuffer(GL_ARRAY_BUFFER, 0);
399388
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
400-
//glFlush();
401389
}
402390

403391
void video_close()
404392
{
405393
gles2_destroy();
406-
// Release OpenGL resources
407394
eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
408395
eglDestroySurface( display, surface );
409396
eglDestroyContext( display, context );

raspberrypi/gles_video.h

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
/*
2-
3-
This file is based on Portable ZX-Spectrum emulator.
4-
Copyright (C) 2001-2012 SMT, Dexus, Alone Coder, deathsoft, djdron, scor
5-
6-
C++ to C code conversion by Pate
7-
8-
Modified by DPR for gpsp for Raspberry Pi
9-
10-
This program is free software: you can redistribute it and/or modify
11-
it under the terms of the GNU General Public License as published by
12-
the Free Software Foundation, either version 3 of the License, or
13-
(at your option) any later version.
14-
15-
This program is distributed in the hope that it will be useful,
16-
but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-
GNU General Public License for more details.
19-
20-
You should have received a copy of the GNU General Public License
21-
along with this program. If not, see <http://www.gnu.org/licenses/>.
22-
23-
*/
2+
*
3+
* This file is based on Portable ZX-Spectrum emulator.
4+
* Copyright (C) 2001-2012 SMT, Dexus, Alone Coder, deathsoft, djdron, scor
5+
*
6+
* C++ to C code conversion by Pate
7+
*
8+
* Modified by DPR for gpsp for Raspberry Pi
9+
*
10+
* This program is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU General Public License as published by
12+
* the Free Software Foundation, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
*
23+
*/
2424

2525
void video_init(uint32_t width,uint32_t height,uint32_t filter);
2626
void video_close();

0 commit comments

Comments
 (0)