Skip to content

Commit 922f55f

Browse files
committed
Remove keybuf and related references
1 parent 0061082 commit 922f55f

5 files changed

Lines changed: 6 additions & 167 deletions

File tree

src/common/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ add_library(common STATIC
3535
clock.c clock.h
3636
fs.c fs.h
3737
gfx.c gfx.h
38-
keybuf.c keybuf.h
3938
prof.c prof.h
4039
webapi.c webapi.h)
4140

@@ -74,7 +73,3 @@ endif()
7473
add_library(ui STATIC
7574
ui.cc ui.h)
7675
add_dependencies(ui imgui-docking common)
77-
78-
# a separate library with just keybuf (for the ASCII emulators)
79-
add_library(keybuf STATIC
80-
keybuf.c keybuf.h)

src/common/common.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99
#include "prof.h"
1010
#include "fs.h"
1111
#include "gfx.h"
12-
#include "keybuf.h"
1312
#include "webapi.h"
14-
#include <ctype.h> // isupper, islower, toupper, tolower
13+
#include <ctype.h> // isupper, islower, toupper, tolower

src/common/keybuf.c

Lines changed: 0 additions & 115 deletions
This file was deleted.

src/common/keybuf.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/x65.c

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ void app_init(void) {
268268
apply_crt_values_csv(arguments.crt_values);
269269
}
270270
}
271-
keybuf_init(&(keybuf_desc_t){ .key_delay_frames = 5 });
272271
clock_init();
273272
prof_init();
274273
fs_init();
@@ -381,7 +380,6 @@ void app_init(void) {
381380
}
382381

383382
static void handle_file_loading(void);
384-
static void send_keybuf_input(void);
385383
static void draw_status_bar(void);
386384

387385
void app_frame(void) {
@@ -394,7 +392,6 @@ void app_frame(void) {
394392
}
395393
gfx_draw(x65_display_info(&state.x65));
396394
handle_file_loading();
397-
send_keybuf_input();
398395
sdl_poll_events();
399396
#ifdef USE_DAP
400397
dap_process();
@@ -419,8 +416,7 @@ void app_input(const sapp_event* event) {
419416
}
420417
#else
421418
if (event->type == SAPP_EVENTTYPE_KEY_DOWN || event->type == SAPP_EVENTTYPE_KEY_UP) {
422-
const bool is_alt_enter = event->key_code == SAPP_KEYCODE_ENTER
423-
&& (event->modifiers & SAPP_MODIFIER_ALT);
419+
const bool is_alt_enter = event->key_code == SAPP_KEYCODE_ENTER && (event->modifiers & SAPP_MODIFIER_ALT);
424420
if (is_alt_enter) {
425421
if (event->type == SAPP_EVENTTYPE_KEY_DOWN) {
426422
sapp_toggle_fullscreen();
@@ -434,8 +430,8 @@ void app_input(const sapp_event* event) {
434430
// input, intercepted (and swallowed) before HID forwarding.
435431
if (event->type == SAPP_EVENTTYPE_KEY_DOWN || event->type == SAPP_EVENTTYPE_KEY_UP) {
436432
const uint32_t hide_ui_mods = SAPP_MODIFIER_CTRL | SAPP_MODIFIER_SHIFT;
437-
const bool is_hide_ui = event->key_code == SAPP_KEYCODE_H
438-
&& ((event->modifiers & hide_ui_mods) == hide_ui_mods);
433+
const bool is_hide_ui =
434+
event->key_code == SAPP_KEYCODE_H && ((event->modifiers & hide_ui_mods) == hide_ui_mods);
439435
if (is_hide_ui) {
440436
if (event->type == SAPP_EVENTTYPE_KEY_DOWN) {
441437
app_set_disable_gui(!disable_gui);
@@ -477,28 +473,12 @@ void app_cleanup(void) {
477473
#endif
478474
}
479475

480-
static void send_keybuf_input(void) {
481-
uint8_t key_code;
482-
if (0 != (key_code = keybuf_get(state.frame_time_us))) {
483-
/* FIXME: this is ugly */
484-
x65_joystick_type_t joy_type = state.x65.joystick_type;
485-
state.x65.joystick_type = X65_JOYSTICKTYPE_NONE;
486-
x65_key_down(&state.x65, key_code);
487-
x65_key_up(&state.x65, key_code);
488-
state.x65.joystick_type = joy_type;
489-
}
490-
}
491-
492476
static void handle_file_loading(void) {
493477
fs_dowork();
494478
const uint32_t load_delay_frames = LOAD_DELAY_FRAMES;
495479
if (fs_success(FS_CHANNEL_IMAGES) && clock_frame_count_60hz() > load_delay_frames) {
496480
bool load_success = false;
497-
if (fs_ext(FS_CHANNEL_IMAGES, "txt") || fs_ext(FS_CHANNEL_IMAGES, "bas")) {
498-
load_success = true;
499-
keybuf_put((const char*)fs_data(FS_CHANNEL_IMAGES).ptr);
500-
}
501-
else if (fs_ext(FS_CHANNEL_IMAGES, "xex")) {
481+
if (fs_ext(FS_CHANNEL_IMAGES, "xex")) {
502482
load_success = x65_quickload_xex(&state.x65, fs_data(FS_CHANNEL_IMAGES));
503483
}
504484
if (load_success) {
@@ -726,7 +706,7 @@ static bool web_load(chips_range_t data) {
726706
}
727707

728708
static void web_input(const char* text) {
729-
keybuf_put(text);
709+
// FIXME: keybuf_put(text);
730710
}
731711

732712
static void web_dbg_add_breakpoint(uint32_t addr) {

0 commit comments

Comments
 (0)