From: sparky4 Date: Sat, 27 Jun 2015 21:48:57 +0000 (-0500) Subject: inputest~ X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=6339995f5499b33983d4f5e5038ae68ff0ecd2e3 inputest~ Signed-off-by: sparky4 --- diff --git a/16.LIB b/16.LIB index 523265fe..dd1d8950 100644 Binary files a/16.LIB and b/16.LIB differ diff --git a/GFX.LIB b/GFX.LIB index 1e340935..30582814 100644 Binary files a/GFX.LIB and b/GFX.LIB differ diff --git a/exmmtest.exe b/exmmtest.exe index 04e9e550..f949a05e 100644 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/inputest.exe b/inputest.exe index 97ba47cd..ca2b4194 100644 Binary files a/inputest.exe and b/inputest.exe differ diff --git a/src/inputest.c b/src/inputest.c index 7d5777d0..15a1b3a5 100644 --- a/src/inputest.c +++ b/src/inputest.c @@ -1,31 +1,35 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 - * - * This file is part of Project 16. - * - * Project 16 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. - * - * Project 16 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 , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ -/* - input test -*/ -#include "src/lib/16_in.h" - -void +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 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. + * + * Project 16 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 , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +/* + input test +*/ +#include "src/lib/16_in.h" + +void main(int argc, char *argv[]) -{ - -} +{ + ControlInfo control; + IN_Startup(); + IN_Default(0,ctrl_Keyboard); + IN_ReadControl(0,&control); + IN_Shutdown(); +} diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 34679d96..0b2da7d8 100644 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -44,7 +44,7 @@ // INL_KeyService() - Handles a keyboard interrupt (key up/down) // /////////////////////////////////////////////////////////////////////////// -static void interrupt +void interrupt INL_KeyService(void) { static boolean special; @@ -112,7 +112,7 @@ static boolean special; outp(0x20,0x20); } -static void +void Mouse(int x) { union REGS CPURegs; @@ -652,6 +652,7 @@ IN_ReadCursor(CursorInfo *info) } } +#ifndef DOMO /////////////////////////////////////////////////////////////////////////// // // IN_ReadControl() - Reads the device associated with the specified @@ -728,14 +729,14 @@ register KeyboardDef *def; type = ctrl_Keyboard1; def = &KbdDefs[type - ctrl_Keyboard]; - if (Keyboard[def->upleft]) +/* if (Keyboard[def->upleft]) mx = motion_Left,my = motion_Up; else if (Keyboard[def->upright]) mx = motion_Right,my = motion_Up; else if (Keyboard[def->downleft]) mx = motion_Left,my = motion_Down; else if (Keyboard[def->downright]) - mx = motion_Right,my = motion_Down; + mx = motion_Right,my = motion_Down;*/ if (Keyboard[def->up]) my = motion_Up; @@ -803,7 +804,7 @@ register KeyboardDef *def; #endif } -#if 0 +#else /////////////////////////////////////////////////////////////////////////// // // IN_ReadControl() - Reads the device associated with the specified @@ -853,14 +854,14 @@ register KeyboardDef *def; case ctrl_Keyboard2: def = &KbdDefs[type - ctrl_Keyboard]; - if (Keyboard[def->upleft]) +/* if (Keyboard[def->upleft]) mx = motion_Left,my = motion_Up; else if (Keyboard[def->upright]) mx = motion_Right,my = motion_Up; else if (Keyboard[def->downleft]) mx = motion_Left,my = motion_Down; else if (Keyboard[def->downright]) - mx = motion_Right,my = motion_Down; + mx = motion_Right,my = motion_Down;*/ if (Keyboard[def->up]) my = motion_Up; diff --git a/src/lib/16_in.h b/src/lib/16_in.h index 1e099ee4..b37a9d5b 100644 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -25,20 +25,22 @@ #ifndef __16_IN__ #define __16_IN__ - + #include "src/lib/lib_head.h" -//#include "src/lib/16_us.h" +//#include "src/lib/16_us.h" -#ifdef __DEBUG__ +//++++#ifdef __DEBUG__ #define __DEBUG_InputMgr__ -#endif - -#define KeyInt 9 // The keyboard ISR number - -// Stuff for the joystick -#define JoyScaleMax 32768 -#define JoyScaleShift 8 -#define MaxJoyValue 5000 +//++++#endif + +#define DOMO + +#define KeyInt 9 // The keyboard ISR number + +// Stuff for the joystick +#define JoyScaleMax 32768 +#define JoyScaleShift 8 +#define MaxJoyValue 5000 #define MaxPlayers 4 #define MaxKbds 2 @@ -138,7 +140,7 @@ typedef byte ScanCode; #ifdef DEMO0 typedef enum { demo_Off,demo_Record,demo_Playback,demo_PlayDone - } Demo; + } Demo; #endif typedef enum { ctrl_None, // MDM (GAMERS EDGE) - added @@ -154,10 +156,10 @@ typedef enum { motion_Right = 1,motion_Down = 1 } Motion; typedef enum { - dir_North,dir_NorthEast, - dir_East,dir_SouthEast, - dir_South,dir_SouthWest, - dir_West,dir_NorthWest, + dir_North,//dir_NorthEast, + dir_East,//dir_SouthEast, + dir_South,//dir_SouthWest, + dir_West,//dir_NorthWest, dir_None } Direction; typedef struct { @@ -167,11 +169,17 @@ typedef struct { Direction dir; } CursorInfo; typedef CursorInfo ControlInfo; + typedef struct { ScanCode button0,button1, - upleft, up, upright, + //upleft, + up, + //upright, left, right, - downleft, down, downright; + //downleft, + down + //,downright + ; } KeyboardDef; typedef struct { word joyMinX,joyMinY, @@ -197,9 +205,9 @@ static boolean JoysPresent[MaxJoys]; static boolean JoyPadPresent; -// Global variables - static boolean JoystickCalibrated=false; // MDM (GAMERS EDGE) - added - static ControlType ControlTypeUsed; // MDM (GAMERS EDGE) - added +// Global variables + static boolean JoystickCalibrated=false; // MDM (GAMERS EDGE) - added + static ControlType ControlTypeUsed; // MDM (GAMERS EDGE) - added static boolean Keyboard[NumCodes]; static boolean Paused; @@ -210,16 +218,16 @@ static boolean JoyPadPresent; static JoystickDef JoyDefs[MaxJoys]; static ControlType Controls[MaxPlayers]; - static dword MouseDownCount; + static dword MouseDownCount; #ifdef DEMO0 static Demo DemoMode = demo_Off; static byte /*_seg*/ *DemoBuffer; - static word DemoOffset,DemoSize; -#endif - -extern dword far* clockdw; - + static word DemoOffset,DemoSize; +#endif + +extern dword far* clockdw; + /* ============================================================================= @@ -271,9 +279,12 @@ static ScanCode CurCode,LastCode; static Direction DirTable[] = // Quick lookup for total direction { - dir_NorthWest, dir_North, dir_NorthEast, + //dir_NorthWest, + dir_North, + //dir_NorthEast, dir_West, dir_None, dir_East, - dir_SouthWest, dir_South, dir_SouthEast + //dir_SouthWest, + dir_South//,dir_SouthEast }; static void (*INL_KeyHook)(void); @@ -296,22 +307,24 @@ extern void IN_Startup(void),IN_Shutdown(void), IN_SetControlType(int,ControlType), IN_GetJoyAbs(word joy,word *xp,word *yp), IN_SetupJoy(word joy,word minx,word maxx, - word miny,word maxy), + word miny,word maxy), + Mouse(int x), #ifdef DEMO0 IN_StartDemoPlayback(byte __segment *buffer,word bufsize), - IN_StopDemo(void),IN_FreeDemoBuffer(void), + IN_StopDemo(void),IN_FreeDemoBuffer(void), #endif IN_Ack(void),IN_AckBack(void); extern boolean IN_UserInput(dword delay,boolean clear), - IN_IsUserInput(void) + IN_IsUserInput(void) #ifdef DEMO0 - , IN_StartDemoRecord(word bufsize) -#endif + , IN_StartDemoRecord(word bufsize) +#endif ; extern byte *IN_GetScanName(ScanCode); extern char IN_WaitForASCII(void); extern ScanCode IN_WaitForKey(void); -extern word IN_GetJoyButtonsDB(word joy); - +extern word IN_GetJoyButtonsDB(word joy); + + //static void interrupt INL_KeyService(void); #endif