Author: hbelusca Date: Fri Feb 28 21:21:41 2014 New Revision: 62359
URL: http://svn.reactos.org/svn/reactos?rev=62359&view=rev Log: [NTVDM] Get rid of ConsoleInput handles in the BIOS; setting input console modes should be done in the emulator.c module itself (when setting user interface modes), and if a mouse is present, handle it in the ps2.c module. Next step will be to get rid of ConsoleOutput handle in the BIOS.
Modified: branches/ntvdm/subsystems/ntvdm/bios/bios.c branches/ntvdm/subsystems/ntvdm/bios/bios.h branches/ntvdm/subsystems/ntvdm/bios/bios32/bios32.c branches/ntvdm/subsystems/ntvdm/bios/bios32/bios32.h branches/ntvdm/subsystems/ntvdm/bios/bios32/kbdbios32.c branches/ntvdm/subsystems/ntvdm/bios/bios32/kbdbios32.h branches/ntvdm/subsystems/ntvdm/emulator.c branches/ntvdm/subsystems/ntvdm/hardware/ps2.c branches/ntvdm/subsystems/ntvdm/ntvdm.c
Modified: branches/ntvdm/subsystems/ntvdm/bios/bios.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios/bios... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios/bios.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios/bios.c [iso-8859-1] Fri Feb 28 21:21:41 2014 @@ -87,7 +87,6 @@
BOOLEAN BiosInitialize(IN LPCSTR BiosFileName, - IN HANDLE ConsoleInput, IN HANDLE ConsoleOutput) { /* Register the BIOS support BOPs */ @@ -144,7 +143,7 @@ } else { - Bios32Loaded = Bios32Initialize(ConsoleInput, ConsoleOutput); + Bios32Loaded = Bios32Initialize(ConsoleOutput); return Bios32Loaded; } }
Modified: branches/ntvdm/subsystems/ntvdm/bios/bios.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios/bios... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios/bios.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios/bios.h [iso-8859-1] Fri Feb 28 21:21:41 2014 @@ -107,7 +107,6 @@
BOOLEAN BiosInitialize(IN LPCSTR BiosFileName, - IN HANDLE ConsoleInput, IN HANDLE ConsoleOutput);
VOID
Modified: branches/ntvdm/subsystems/ntvdm/bios/bios32/bios32.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios/bios... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios/bios32/bios32.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios/bios32/bios32.c [iso-8859-1] Fri Feb 28 21:21:41 2014 @@ -361,8 +361,7 @@ /* * The BIOS POST (Power On-Self Test) */ -BOOLEAN Bios32Initialize(IN HANDLE ConsoleInput, - IN HANDLE ConsoleOutput) +BOOLEAN Bios32Initialize(IN HANDLE ConsoleOutput) { BOOLEAN Success; UCHAR Low, High; @@ -401,10 +400,7 @@ BiosHwSetup();
/* Initialize the Keyboard BIOS */ - if (!KbdBios32Initialize(ConsoleInput)) return FALSE; - - /* Set the console input mode */ - SetConsoleMode(ConsoleInput, ENABLE_MOUSE_INPUT | ENABLE_PROCESSED_INPUT); + if (!KbdBios32Initialize()) return FALSE;
/* Initialize the Video BIOS */ if (!VidBios32Initialize(ConsoleOutput)) return FALSE;
Modified: branches/ntvdm/subsystems/ntvdm/bios/bios32/bios32.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios/bios... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios/bios32/bios32.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios/bios32/bios32.h [iso-8859-1] Fri Feb 28 21:21:41 2014 @@ -129,8 +129,7 @@ VOID EnableHwIRQ(UCHAR hwirq, EMULATOR_INT32_PROC func); VOID PicIRQComplete(LPWORD Stack);
-BOOLEAN Bios32Initialize(IN HANDLE ConsoleInput, - IN HANDLE ConsoleOutput); +BOOLEAN Bios32Initialize(IN HANDLE ConsoleOutput); VOID Bios32Cleanup(VOID);
#endif // _BIOS32_H_
Modified: branches/ntvdm/subsystems/ntvdm/bios/bios32/kbdbios32.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios/bios... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios/bios32/kbdbios32.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios/bios32/kbdbios32.c [iso-8859-1] Fri Feb 28 21:21:41 2014 @@ -261,7 +261,7 @@
/* PUBLIC FUNCTIONS ***********************************************************/
-BOOLEAN KbdBios32Initialize(HANDLE ConsoleInput) +BOOLEAN KbdBios32Initialize(VOID) { /* Initialize the BDA */ Bda->KeybdBufferStart = FIELD_OFFSET(BIOS_DATA_AREA, KeybdBuffer); @@ -277,9 +277,6 @@ EnableHwIRQ(1, BiosKeyboardIrq); // EnableHwIRQ(12, BiosMouseIrq);
- /* Set the console input mode */ - // SetConsoleMode(ConsoleInput, ENABLE_MOUSE_INPUT | ENABLE_PROCESSED_INPUT); - return TRUE; }
Modified: branches/ntvdm/subsystems/ntvdm/bios/bios32/kbdbios32.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios/bios... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/bios/bios32/kbdbios32.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/bios/bios32/kbdbios32.h [iso-8859-1] Fri Feb 28 21:21:41 2014 @@ -40,7 +40,7 @@
WORD BiosGetCharacter(VOID);
-BOOLEAN KbdBios32Initialize(HANDLE ConsoleInput); +BOOLEAN KbdBios32Initialize(VOID); VOID KbdBios32Cleanup(VOID);
#endif // _KBDBIOS32_H_
Modified: branches/ntvdm/subsystems/ntvdm/emulator.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/emulator.... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] Fri Feb 28 21:21:41 2014 @@ -384,7 +384,9 @@ PS2Initialize(ConsoleInput);
/* Set the console input mode */ - // SetConsoleMode(ConsoleInput, ENABLE_MOUSE_INPUT | ENABLE_PROCESSED_INPUT); + // FIXME: Activate ENABLE_WINDOW_INPUT when we will want to perform actions + // upon console window events (screen buffer resize, ...). + SetConsoleMode(ConsoleInput, ENABLE_PROCESSED_INPUT /* | ENABLE_WINDOW_INPUT */);
/* Start the input thread */ InputThread = CreateThread(NULL, 0, &PumpConsoleInput, ConsoleInput, 0, NULL);
Modified: branches/ntvdm/subsystems/ntvdm/hardware/ps2.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/hardware/... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/hardware/ps2.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/hardware/ps2.c [iso-8859-1] Fri Feb 28 21:21:41 2014 @@ -325,6 +325,10 @@
BOOLEAN PS2Initialize(HANDLE ConsoleInput) { +#if 0 + DWORD ConInMode; +#endif + /* Create the mutex */ QueueMutex = CreateMutex(NULL, FALSE, NULL);
@@ -332,6 +336,21 @@ RegisterIoPort(PS2_CONTROL_PORT, PS2ReadPort, PS2WritePort); RegisterIoPort(PS2_DATA_PORT , PS2ReadPort, PS2WritePort);
+#if 0 + if (MousePresent) + { + /* Support mouse input events if there is a mouse on the system */ + if (GetConsoleMode(ConsoleInput, &ConInMode)) + SetConsoleMode(ConsoleInput, ConInMode | ENABLE_MOUSE_INPUT); + } + else + { + /* Do not support mouse input events if there is no mouse on the system */ + if (GetConsoleMode(ConsoleInput, &ConInMode)) + SetConsoleMode(ConsoleInput, ConInMode & ~ENABLE_MOUSE_INPUT); + } +#endif + return TRUE; }
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?r... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] Fri Feb 28 21:21:41 2014 @@ -400,7 +400,7 @@ }
/* Initialize the system BIOS */ - if (!BiosInitialize(NULL, ConsoleInput, ConsoleOutput)) + if (!BiosInitialize(NULL, ConsoleOutput)) { wprintf(L"FATAL: Failed to initialize the VDM BIOS.\n"); goto Cleanup;