Skip to content

Commit 0a87e9f

Browse files
committed
EP128: add OSK support #435
Also needed for #98
1 parent 8d904f6 commit 0a87e9f

File tree

6 files changed

+122
-6
lines changed

6 files changed

+122
-6
lines changed

targets/ep128/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
2-
## Copyright (C)2016-2021 LGB (Gábor Lénárt) <[email protected]>
2+
## Copyright (C)2016-2021,2025 LGB (Gábor Lénárt) <[email protected]>
33
#
44
# This program is free software; you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ PRG_TARGET = xep128
2020
EMU_DESCRIPTION = Enterprise 128
2121

2222
SRCS_TARGET_xep128 = configdb.c enterprise128.c cpu.c z180.c nick.c dave.c input_devices.c exdos_wd.c sdext.c rtc.c printer.c zxemu.c primoemu.c emu_rom_interface.c epnet.c apu.c roms.c emu_monitor.c fileio.c snapshot.c ui.c
23-
SRCS_COMMON_xep128 = emutools.c emutools_files.c emutools_config.c emutools_gui.c emutools_hid.c z80.c z80_dasm.c emutools_socketapi.c lodepng.c
23+
SRCS_COMMON_xep128 = emutools.c emutools_files.c emutools_config.c emutools_gui.c emutools_hid.c z80.c z80_dasm.c emutools_socketapi.c lodepng.c emutools_osk.c
2424
CFLAGS_TARGET_xep128 = $(SDL2_CFLAGS) $(MATH_CFLAGS) $(SOCKET_CFLAGS) $(XEMUGUI_CFLAGS) $(READLINE_CFLAGS)
2525
LDFLAGS_TARGET_xep128 = $(SDL2_LIBS) $(MATH_LIBS) $(SOCKET_LIBS) $(XEMUGUI_LIBS) $(READLINE_LIBS)
2626

targets/ep128/enterprise128.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Minimalistic Enterprise-128 emulator with focus on "exotic" hardware
22
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
3-
Copyright (C)2015-2017,2020-2021 LGB (Gábor Lénárt) <[email protected]>
3+
Copyright (C)2015-2017,2020-2021,2025 LGB (Gábor Lénárt) <[email protected]>
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -278,6 +278,9 @@ int main (int argc, char *argv[])
278278
#else
279279
if (!configdb.syscon)
280280
sysconsole_close(NULL);
281+
#endif
282+
#ifdef XEMU_OSK_SUPPORT
283+
osk_init(osk_desc, SCREEN_WIDTH, SCREEN_HEIGHT * 2, 40);
281284
#endif
282285
clear_emu_events();
283286
xemu_timekeeping_start();

targets/ep128/input_devices.c

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Minimalistic Enterprise-128 emulator with focus on "exotic" hardware
22
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
3-
Copyright (C)2015-2016,2020 LGB (Gábor Lénárt) <[email protected]>
3+
Copyright (C)2015-2016,2020,2025 LGB (Gábor Lénárt) <[email protected]>
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -133,6 +133,97 @@ const struct KeyMappingDefault ep128_key_map[] = {
133133
{ 0, -1, NULL }
134134
};
135135

136+
137+
#ifdef XEMU_OSK_SUPPORT
138+
const struct osk_desc_st osk_desc[] = {
139+
{0, 5,17,"F1", 0x47},
140+
{0, 0,17,"F2", 0x46},
141+
{0, 0,17,"F3", 0x42},
142+
{0, 0,17,"F4", 0x40},
143+
{0, 0,17,"F5", 0x44},
144+
{0, 0,17,"F6", 0x43},
145+
{0, 0,17,"F7", 0x45},
146+
{0, 0,17,"F8", 0x41},
147+
{0, 4,10,"HOLD", 0x74},
148+
{0, 0,17,"STOP", 0x70},
149+
150+
151+
{OSK_DESC_NEW_LINE, 2,10,"ESC", 0x37},
152+
{0, 0,10,"1\n!", 0x31},
153+
{0, 0,10,"2\n\"", 0x36},
154+
{0, 0,10,"3\nPnd", 0x35},
155+
{0, 0,10,"4\n$", 0x33},
156+
{0, 0,10,"5\n%", 0x34},
157+
{0, 0,10,"6\n&", 0x32},
158+
{0, 0,10,"7\n'", 0x30},
159+
{0, 0,10,"8\n(", 0x50},
160+
{0, 0,10,"9\n)", 0x52},
161+
{0, 0,10,"0\n_", 0x54},
162+
{0, 0,10,"-\n=", 0x53},
163+
{0, 0,10,"^\n~", -1 }, // TODO
164+
{0, 0,15,"ERASE", 0x56},
165+
{0, 0,15,"DEL", 0x81},
166+
{0, 0,10,"INS", 0x87},
167+
168+
169+
{OSK_DESC_NEW_LINE, 2,15,"TAB", 0x27},
170+
{0, 0,10,"Q", 0x21},
171+
{0, 0,10,"W", 0x26},
172+
{0, 0,10,"E", 0x25},
173+
{0, 0,10,"R", 0x23},
174+
{0, 0,10,"T", 0x24},
175+
{0, 0,10,"Y", 0x22},
176+
{0, 0,10,"U", 0x20},
177+
{0, 0,10,"I", 0x90},
178+
{0, 0,10,"O", 0x92},
179+
{0, 0,10,"P", 0x94},
180+
{0, 0,10,"@\n`", 0x93},
181+
{0, 0,10,"[\n{", 0x95},
182+
{0, 0,15,"ENTER", 0x76},
183+
184+
185+
{OSK_DESC_NEW_LINE | OSK_DESC_TOGGLE, 0,10,"CTRL", 0x17},
186+
{0, 0,10,"Lck", -1}, // TODO
187+
{0, 0,10,"A", 0x16},
188+
{0, 0,10,"S", 0x15},
189+
{0, 0,10,"D", 0x13},
190+
{0, 0,10,"F", 0x14},
191+
{0, 0,10,"G", 0x12},
192+
{0, 0,10,"H", 0x10},
193+
{0, 0,10,"J", 0x60},
194+
{0, 0,10,"K", 0x62},
195+
{0, 0,10,"L", 0x64},
196+
{0, 0,10,";\n+", 0x63},
197+
{0, 0,10,":\n*", 0x65},
198+
{0, 0,10,"]\n}", 0x66},
199+
{0, 17,10,"UP", 0x73},
200+
201+
{OSK_DESC_NEW_LINE | OSK_DESC_TOGGLE | OSK_DESC_MOD_KEY, 0,15,"Shift", 0x07},
202+
{0, 0,10,"\\\n|", 0x04},
203+
{0, 0,10,"Z", 0x06},
204+
{0, 0,10,"X", 0x05},
205+
{0, 0,10,"C", 0x03},
206+
{0, 0,10,"V", 0x04},
207+
{0, 0,10,"B", 0x02},
208+
{0, 0,10,"N", 0x00},
209+
{0, 0,10,"M", 0x80},
210+
{0, 0,10,",\n<", 0x82},
211+
{0, 0,10,".\n>", 0x84},
212+
{0, 0,10,"/\n?", 0x83},
213+
{OSK_DESC_TOGGLE | OSK_DESC_MOD_KEY, 0,15,"Shift", 0x85},
214+
{0, 12,10,"LEFT", 0x75},
215+
{0, 0,10,"RIGHT", 0x72},
216+
217+
218+
{OSK_DESC_NEW_LINE, 38, 80, "SPACE", 0x86},
219+
{OSK_DESC_TOGGLE, 12,10,"ALT", -1}, // TODO
220+
{0, 17,10,"DOWN", 0x71},
221+
222+
{.key_str = NULL}
223+
};
224+
#endif
225+
226+
136227
/* The mouse buffer. nibble_counter shows which nibble is to read (thus "nibble_counter >> 1" is the byte pointer actually.
137228
mouse_protocol_nibbles limits the max nibbles to read, ie it's 4 (= 2 bytes) for boxsoft protocol for the default setting */
138229
static Uint8 mouse_buffer[] = {

targets/ep128/input_devices.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Minimalistic Enterprise-128 emulator with focus on "exotic" hardware
22
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
3-
Copyright (C)2015-2016,2020 LGB (Gábor Lénárt) <[email protected]>
3+
Copyright (C)2015-2016,2020,2025 LGB (Gábor Lénárt) <[email protected]>
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -32,6 +32,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
3232
#define VIRTUAL_SHIFT_POS 0x07
3333

3434
extern const struct KeyMappingDefault ep128_key_map[];
35+
#ifdef XEMU_OSK_SUPPORT
36+
#include "xemu/emutools_osk.h"
37+
extern const struct osk_desc_st osk_desc[];
38+
#endif
3539

3640
extern int mouse_grab, show_keys, mouse_mode;
3741

targets/ep128/ui.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Minimalistic Enterprise-128 emulator with focus on "exotic" hardware
22
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
3-
Copyright (C)2016-2021 LGB (Gábor Lénárt) <[email protected]>
3+
Copyright (C)2016-2021,2025 LGB (Gábor Lénárt) <[email protected]>
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
2121
#include "xemu/emutools_gui.h"
2222
#include "xemu/emutools_files.h"
2323
#include "xemu/emutools_hid.h"
24+
#include "xemu/emutools_osk.h"
2425

2526
#include "ui.h"
2627

@@ -102,8 +103,20 @@ static void ui_cb_render_scale_quality ( const struct menu_st *m, int *query )
102103
register_new_texture_creation = 1;
103104
}
104105

106+
107+
#ifdef XEMU_OSK_SUPPORT
108+
static void ui_cb_show_osk ( const struct menu_st *m, int *query )
109+
{
110+
const bool status = osk_status();
111+
XEMUGUI_RETURN_CHECKED_ON_QUERY(query, status);
112+
osk_show(!status);
113+
}
114+
#endif
115+
116+
105117
/**** MENU SYSTEM ****/
106118

119+
107120
static const struct menu_st menu_render_scale_quality[] = {
108121
{ "Nearest pixel sampling", XEMUGUI_MENUID_CALLABLE |
109122
XEMUGUI_MENUFLAG_QUERYBACK, ui_cb_render_scale_quality, (void*)0 },
@@ -121,6 +134,10 @@ static const struct menu_st menu_display[] = {
121134
XEMUGUI_MENUFLAG_SEPARATOR, xemugui_cb_windowsize, (void*)2 },
122135
{ "Enable mouse grab + emu", XEMUGUI_MENUID_CALLABLE |
123136
XEMUGUI_MENUFLAG_QUERYBACK, xemugui_cb_set_mouse_grab, NULL },
137+
#ifdef XEMU_OSK_SUPPORT
138+
{ "Show OSK", XEMUGUI_MENUID_CALLABLE |
139+
XEMUGUI_MENUFLAG_QUERYBACK, ui_cb_show_osk, NULL },
140+
#endif
124141
{ NULL }
125142
};
126143
static const struct menu_st menu_debug[] = {

targets/ep128/xemu-target.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define XEMU_USE_LODEPNG
1919
#define XEMU_FILES_SCREENSHOT_SUPPORT
2020
#define HAVE_XEMU_EXEC_API
21+
#define XEMU_OSK_SUPPORT
2122
#endif
2223

2324
#define CONFIG_EMSCRIPTEN_OK

0 commit comments

Comments
 (0)