aboutsummaryrefslogtreecommitdiff
path: root/utils/adlmidi-2/input.hpp
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2017-11-09 22:50:32 +0300
committerWohlstand <admin@wohlnet.ru>2017-11-09 22:50:32 +0300
commit0be25a41ca793c3c03814f529890492adfac8ad5 (patch)
treea099d0025109b689bb0d6847e83b9890e34d5d35 /utils/adlmidi-2/input.hpp
parent265ae7a37afb087b9e16f4ddd0eaef28a21826de (diff)
downloadlibADLMIDI-0be25a41ca793c3c03814f529890492adfac8ad5.tar.gz
libADLMIDI-0be25a41ca793c3c03814f529890492adfac8ad5.tar.bz2
libADLMIDI-0be25a41ca793c3c03814f529890492adfac8ad5.zip
Resolve weird crash caused by Tetris inside ADLMIDI2 and other changes
- Move most of inline classes methods into own CC file - Move Input into own header with own CC file to share it with the puzzle game - Created virtual destructors and resolved weak vtable trouble between of Tetris's classes - Remove static declarisons of Tetris class. Instead, let it be member of UserInterface - Fixed forgot note-offs while sorting events row with zero length notes - Fixed crash caused by unsafe access by reference to element of array that was modified/reallocated one or multiple times - Stabilize dealing with zero-length notes
Diffstat (limited to 'utils/adlmidi-2/input.hpp')
-rw-r--r--utils/adlmidi-2/input.hpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/utils/adlmidi-2/input.hpp b/utils/adlmidi-2/input.hpp
new file mode 100644
index 0000000..dba4229
--- /dev/null
+++ b/utils/adlmidi-2/input.hpp
@@ -0,0 +1,46 @@
+#ifndef _WIN32
+#include <unistd.h>
+#endif
+
+#ifdef _WIN32
+# include <cctype>
+# define WIN32_LEAN_AND_MEAN
+# ifndef NOMINMAX
+# define NOMINMAX //To don't damage std::min and std::max
+# endif
+# include <windows.h>
+#endif
+
+#ifdef __DJGPP__
+#include <conio.h>
+#include <pc.h>
+#include <dpmi.h>
+#include <go32.h>
+#include <sys/farptr.h>
+#include <dos.h>
+#include <stdlib.h>
+#define BIOStimer _farpeekl(_dos_ds, 0x46C)
+static const unsigned NewTimerFreq = 209;
+#elif !defined(_WIN32) || defined(__CYGWIN__)
+# include <termios.h>
+# include <fcntl.h>
+# include <sys/ioctl.h>
+# include <csignal>
+#endif
+
+class xInput
+{
+ #ifdef _WIN32
+ void *inhandle;
+ #endif
+ #if (!defined(_WIN32) || defined(__CYGWIN__)) && !defined(__DJGPP__)
+ struct termio back;
+ #endif
+public:
+ xInput();
+ ~xInput();
+
+ char PeekInput();
+};
+
+extern xInput Input;