From bb7b6e8532ef3282fdd15ec133deff919cd7e7c3 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 23 Apr 2023 09:42:21 +0800 Subject: Initial work to add debug menu from 3dsspec --- include/debug.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/gui.h | 1 + include/keyboard.h | 4 ++++ 3 files changed, 58 insertions(+) create mode 100644 include/debug.h (limited to 'include') diff --git a/include/debug.h b/include/debug.h new file mode 100644 index 0000000..a6fce71 --- /dev/null +++ b/include/debug.h @@ -0,0 +1,53 @@ +/* + + 3ds81 - Nintendo 3DS ZX81 emulator + + Copyright (C) 2021 Ian Cowburn (ianc@noddybox.co.uk) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see + + ------------------------------------------------------------------------- + + Provides an interface for debug + +*/ + +#ifndef DSSPEC_DEBUG_H +#define DSSPEC_DEBUG_H + +/* This variable is TRUE if debug is enabled. Also use this for setting the + mode. +*/ +extern int debug_enabled; + +/* Use this macro to use debug. It saves a function call if debug is disabled. +*/ +#define SPEC_DEBUG(...) \ +do \ +{ \ + if (debug_enabled) DEBUG_Output(__VA_ARGS__); \ +} while(0) + +/* The host and port to use for the debug +*/ +void DEBUG_SetAddress(const char *host, const char *port); + +/* The debug interface. Takes a printf style format and parameters. +*/ +void DEBUG_Output(const char *format, ...); + +#endif + + +/* END OF FILE */ diff --git a/include/gui.h b/include/gui.h index 3dd3fe2..c5eeaed 100644 --- a/include/gui.h +++ b/include/gui.h @@ -28,5 +28,6 @@ int GUI_FileSelect(char pwd[], char selected_file[], const char *filter); int GUI_InputName(const char *prompt, const char *ext, char name[], int maxlen); +int GUI_Input(const char *prompt, char text[], int maxlen); #endif /* DS81_GUI_H */ diff --git a/include/keyboard.h b/include/keyboard.h index f0671f0..e0d247c 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -127,6 +127,10 @@ void SK_DefinePad(SoftKey pad, SoftKey key); */ const char *SK_KeyName(SoftKey pad); +/* Returns TRUE if the passed key is currently pressed +*/ +int SK_KeyPressed(SoftKey key); + /* Allows the keyboard to save/restore its state from a stream */ void SK_SaveSnapshot(FILE *fp); -- cgit v1.2.3