Allows use of gfx without SDL on WIndows
X-1.5 Camiel Vanderhoeven 05-MAR-2008 Multi-threading version.
X-1.4 Camiel Vanderhoeven 12-FEB-2008 Moved keyboard code into it's own class (CKeyboard)
X-1.3 Camiel Vanderhoeven 22-JAN-2008 Commented out mousewheel-code, doesn't work with older win32 versions.
X-1.2 Camiel Vanderhoeven 19-JAN-2008 Changed window title.
X-1.1 Camiel Vanderhoeven 19-JAN-2008 Initial version for ES40 emulator.
Definition in file gui_win32.cpp.
#include "../StdAfx.h"
#include <process.h>
#include "gui_win32_font.h"
#include "keymap.h"
#include "../Configurator.h"
#include "../VGA.h"
#include "../Keyboard.h"
#include "gui.h"
Go to the source code of this file.
Data Structures | |
| class | bx_win32_gui_c |
| struct | QueueEvent |
| struct | sharedThreadInfo |
Defines | |
| #define | EXIT_GUI_SHUTDOWN 1 |
| #define | EXIT_GMH_FAILURE 2 |
| #define | EXIT_FONT_BITMAP_ERROR 3 |
| #define | EXIT_NORMAL 4 |
| #define | EXIT_HEADER_BITMAP_ERROR 5 |
| #define | SCANCODE_BUFSIZE 20 |
| #define | MOUSE_PRESSED 0x20000000 |
| #define | MOUSE_MOTION 0x22000000 |
| #define | BX_SYSKEY (KF_UP | KF_REPEAT | KF_ALTDOWN) |
Functions | |
| int | libwin32_LTX_plugin_init (CConfigurator *cfg) |
| void | libwin32_LTX_plugin_fini (void) |
| void | enq_key_event (u32, u32) |
| void | enq_mouse_event (void) |
| QueueEvent * | deq_key_event (void) |
| LRESULT CALLBACK | mainWndProc (HWND, UINT, WPARAM, LPARAM) |
| LRESULT CALLBACK | simWndProc (HWND, UINT, WPARAM, LPARAM) |
| VOID | UIThread (PVOID) |
| void | terminateEmul (int) |
| void | create_vga_font (void) |
| static unsigned char | reverse_bitorder (unsigned char) |
| void | DrawBitmap (HDC, HBITMAP, int, int, int, int, int, int, DWORD, unsigned char) |
| void | DrawChar (HDC, unsigned char, int, int, unsigned char cColor, int, int) |
| void | updateUpdated (int, int, int, int) |
| static void | processMouseXY (int x, int y, int z, int windows_state, int implied_state_change) |
| static void | resetDelta () |
| static void | cursorWarped () |
| void | resize_main_window () |
| void | SetMouseCapture () |
| COLORREF | GetColorRef (unsigned char attr) |
Variables | |
| static bx_win32_gui_c * | theGui = NULL |
| static QueueEvent | keyevents [20] |
| static unsigned | head = 0 |
| static unsigned | tail = 0 |
| static int | mouse_button_state = 0 |
| static int | ms_xdelta = 0 |
| static int | ms_ydelta = 0 |
| static int | ms_zdelta = 0 |
| static int | ms_lastx = 0 |
| static int | ms_lasty = 0 |
| static int | ms_savedx = 0 |
| static int | ms_savedy = 0 |
| static BOOL | mouseCaptureMode |
| static BOOL | mouseCaptureNew |
| static BOOL | mouseToggleReq |
| static unsigned long | workerThread = 0 |
| static DWORD | workerThreadID = 0 |
| static int | mouse_buttons = 3 |
| static unsigned | x_tilesize = 0 |
| static unsigned | y_tilesize = 0 |
| static BITMAPINFO * | bitmap_info = (BITMAPINFO*) 0 |
| static RGBQUAD * | cmap_index |
| static HBITMAP | MemoryBitmap = NULL |
| static HDC | MemoryDC = NULL |
| static RECT | updated_area |
| static BOOL | updated_area_valid = false |
| static HWND | desktopWindow |
| static RECT | desktop |
| static BOOL | queryFullScreen = false |
| static int | desktop_x |
| static int | desktop_y |
| static unsigned | prev_cursor_x = 0 |
| static unsigned | prev_cursor_y = 0 |
| static HBITMAP | vgafont [256] |
| static int | xChar = 8 |
| static int | yChar = 16 |
| static unsigned int | text_rows = 25 |
| static unsigned int | text_cols = 80 |
| static u8 | text_pal_idx [16] |
| static u8 | h_panning = 0 |
| static u8 | v_panning = 0 |
| static u16 | line_compare = 1023 |
| static unsigned | dimension_x |
| static unsigned | dimension_y |
| static unsigned | current_bpp |
| static unsigned | stretched_x |
| static unsigned | stretched_y |
| static unsigned | stretch_factor = 1 |
| static BOOL | BxTextMode = true |
| static BOOL | fix_size = false |
| static HWND | hotKeyReceiver = NULL |
| static HWND | saveParent = NULL |
| static char | szAppName [] = "ES40 Emulator" |
| static char | szWindowName [] = "ES40 Emulator" |
| sharedThreadInfo | stInfo |
| u32 | win32_to_bx_key [2][0x100] |
| #define BX_SYSKEY (KF_UP | KF_REPEAT | KF_ALTDOWN) |
| #define EXIT_FONT_BITMAP_ERROR 3 |
| #define EXIT_GMH_FAILURE 2 |
Definition at line 106 of file gui_win32.cpp.
Referenced by bx_win32_gui_c::specific_init(), and terminateEmul().
| #define EXIT_GUI_SHUTDOWN 1 |
| #define EXIT_HEADER_BITMAP_ERROR 5 |
Definition at line 109 of file gui_win32.cpp.
| #define EXIT_NORMAL 4 |
Definition at line 108 of file gui_win32.cpp.
Referenced by bx_win32_gui_c::exit(), and terminateEmul().
| #define MOUSE_MOTION 0x22000000 |
Definition at line 114 of file gui_win32.cpp.
Referenced by enq_mouse_event(), and bx_win32_gui_c::handle_events().
| #define MOUSE_PRESSED 0x20000000 |
Definition at line 113 of file gui_win32.cpp.
Referenced by bx_win32_gui_c::handle_events(), and processMouseXY().
| #define SCANCODE_BUFSIZE 20 |
Definition at line 112 of file gui_win32.cpp.
Referenced by deq_key_event(), enq_key_event(), and enq_mouse_event().
| void create_vga_font | ( | void | ) |
Definition at line 1879 of file gui_win32.cpp.
References bx_vgafont, EXIT_FONT_BITMAP_ERROR, reverse_bitorder(), and terminateEmul().
Referenced by bx_win32_gui_c::specific_init().
| static void cursorWarped | ( | ) | [static] |
Definition at line 534 of file gui_win32.cpp.
References enq_mouse_event(), sharedThreadInfo::keyCS, sharedThreadInfo::mouseCS, ms_lasty, and ms_savedy.
Referenced by SetMouseCapture(), simWndProc(), and UIThread().
| QueueEvent * deq_key_event | ( | void | ) |
Definition at line 1274 of file gui_win32.cpp.
References BX_ERROR, SCANCODE_BUFSIZE, and tail.
Referenced by bx_win32_gui_c::handle_events().
| void DrawBitmap | ( | HDC | hdc, | |
| HBITMAP | hBitmap, | |||
| int | xStart, | |||
| int | yStart, | |||
| int | width, | |||
| int | height, | |||
| int | fcol, | |||
| int | frow, | |||
| DWORD | dwRop, | |||
| unsigned char | cColor | |||
| ) |
Definition at line 1916 of file gui_win32.cpp.
References GetColorRef(), and updateUpdated().
Referenced by bx_win32_gui_c::text_update().
| void DrawChar | ( | HDC | , | |
| unsigned | char, | |||
| int | , | |||
| int | , | |||
| unsigned char | cColor, | |||
| int | , | |||
| int | ||||
| ) |
Referenced by bx_win32_gui_c::text_update().
Definition at line 1169 of file gui_win32.cpp.
References BX_ERROR, BX_KEY_PRESSED, BX_KEY_RELEASED, QueueEvent::key_event, SCANCODE_BUFSIZE, and tail.
Referenced by processMouseXY(), and simWndProc().
| void enq_mouse_event | ( | void | ) |
Definition at line 1250 of file gui_win32.cpp.
References BX_ERROR, QueueEvent::key_event, QueueEvent::mouse_button_state, MOUSE_MOTION, QueueEvent::mouse_x, QueueEvent::mouse_y, QueueEvent::mouse_z, sharedThreadInfo::mouseCS, ms_ydelta, ms_zdelta, resetDelta(), SCANCODE_BUFSIZE, and tail.
Referenced by cursorWarped(), bx_win32_gui_c::handle_events(), and processMouseXY().
| COLORREF GetColorRef | ( | unsigned char | attr | ) |
| void libwin32_LTX_plugin_fini | ( | void | ) |
Definition at line 104 of file gui_win32.cpp.
| int libwin32_LTX_plugin_init | ( | CConfigurator * | cfg | ) |
Definition at line 104 of file gui_win32.cpp.
| LRESULT CALLBACK mainWndProc | ( | HWND | hwnd, | |
| UINT | iMsg, | |||
| WPARAM | wParam, | |||
| LPARAM | lParam | |||
| ) |
Definition at line 860 of file gui_win32.cpp.
References BX_ERROR, and sharedThreadInfo::simWnd.
Referenced by UIThread().
| static void processMouseXY | ( | int | x, | |
| int | y, | |||
| int | z, | |||
| int | windows_state, | |||
| int | implied_state_change | |||
| ) | [static] |
Definition at line 486 of file gui_win32.cpp.
References BX_INFO, enq_key_event(), enq_mouse_event(), sharedThreadInfo::keyCS, MOUSE_PRESSED, sharedThreadInfo::mouseCS, ms_lasty, ms_savedy, ms_ydelta, and ms_zdelta.
Referenced by simWndProc().
| static void resetDelta | ( | ) | [static] |
Definition at line 525 of file gui_win32.cpp.
References sharedThreadInfo::mouseCS, ms_lasty, ms_savedy, ms_ydelta, and ms_zdelta.
Referenced by enq_mouse_event().
| void resize_main_window | ( | ) |
Definition at line 688 of file gui_win32.cpp.
References BX_DEBUG, sharedThreadInfo::mainWnd, and sharedThreadInfo::simWnd.
Referenced by bx_win32_gui_c::dimension_update(), simWndProc(), and UIThread().
| unsigned char reverse_bitorder | ( | unsigned char | b | ) | [static] |
| void SetMouseCapture | ( | ) |
Definition at line 908 of file gui_win32.cpp.
References cursorWarped(), and sharedThreadInfo::simWnd.
Referenced by simWndProc().
| LRESULT CALLBACK simWndProc | ( | HWND | hwnd, | |
| UINT | iMsg, | |||
| WPARAM | wParam, | |||
| LPARAM | lParam | |||
| ) |
Definition at line 930 of file gui_win32.cpp.
References BX_INFO, BX_KEY_PRESSED, BX_KEY_RELEASED, BX_SYSKEY, cursorWarped(), bx_win32_gui_c::dimension_update(), sharedThreadInfo::drawCS, enq_key_event(), sharedThreadInfo::keyCS, sharedThreadInfo::mainWnd, processMouseXY(), resize_main_window(), SetMouseCapture(), and sharedThreadInfo::UIinited.
Referenced by UIThread().
| void terminateEmul | ( | int | reason | ) |
Definition at line 548 of file gui_win32.cpp.
References sharedThreadInfo::drawCS, EXIT_FONT_BITMAP_ERROR, EXIT_GMH_FAILURE, EXIT_GUI_SHUTDOWN, EXIT_NORMAL, FAILURE, sharedThreadInfo::keyCS, and sharedThreadInfo::mouseCS.
Referenced by create_vga_font(), bx_win32_gui_c::exit(), bx_win32_gui_c::handle_events(), and bx_win32_gui_c::specific_init().
| VOID UIThread | ( | PVOID | pvoid | ) |
Definition at line 745 of file gui_win32.cpp.
References bx_gui, BX_INFO, BX_MAX_XRES, BX_MAX_YRES, bx_gui_c::clear_screen(), cursorWarped(), EXIT_GUI_SHUTDOWN, sharedThreadInfo::hInstance, sharedThreadInfo::kill, sharedThreadInfo::mainWnd, mainWndProc(), resize_main_window(), sharedThreadInfo::simWnd, simWndProc(), and sharedThreadInfo::UIinited.
Referenced by bx_win32_gui_c::specific_init().
| void updateUpdated | ( | int | x1, | |
| int | y1, | |||
| int | x2, | |||
| int | y2 | |||
| ) |
Definition at line 1960 of file gui_win32.cpp.
Referenced by bx_win32_gui_c::clear_screen(), DrawBitmap(), and bx_win32_gui_c::graphics_tile_update().
BITMAPINFO* bitmap_info = (BITMAPINFO*) 0 [static] |
Definition at line 142 of file gui_win32.cpp.
BOOL BxTextMode = true [static] |
Definition at line 168 of file gui_win32.cpp.
RGBQUAD* cmap_index [static] |
Definition at line 143 of file gui_win32.cpp.
unsigned current_bpp [static] |
Definition at line 165 of file gui_win32.cpp.
RECT desktop [static] |
Definition at line 149 of file gui_win32.cpp.
int desktop_x [static] |
Definition at line 151 of file gui_win32.cpp.
int desktop_y [static] |
Definition at line 151 of file gui_win32.cpp.
HWND desktopWindow [static] |
Definition at line 148 of file gui_win32.cpp.
unsigned dimension_x [static] |
Definition at line 165 of file gui_win32.cpp.
unsigned dimension_y [static] |
Definition at line 165 of file gui_win32.cpp.
Referenced by bx_x11_gui_c::clear_screen(), bx_x11_gui_c::dimension_update(), bx_x11_gui_c::graphics_tile_get(), bx_x11_gui_c::graphics_tile_update(), bx_x11_gui_c::specific_init(), and bx_x11_gui_c::text_update().
BOOL fix_size = false [static] |
Definition at line 169 of file gui_win32.cpp.
unsigned head = 0 [static] |
Definition at line 130 of file gui_win32.cpp.
HWND hotKeyReceiver = NULL [static] |
Definition at line 170 of file gui_win32.cpp.
QueueEvent keyevents[20] [static] |
Definition at line 129 of file gui_win32.cpp.
u16 line_compare = 1023 [static] |
Definition at line 162 of file gui_win32.cpp.
Referenced by bx_sdl_gui_c::text_update(), CS3Trio64::update(), and CCirrus::update().
HBITMAP MemoryBitmap = NULL [static] |
Definition at line 144 of file gui_win32.cpp.
HDC MemoryDC = NULL [static] |
Definition at line 145 of file gui_win32.cpp.
int mouse_button_state = 0 [static] |
Definition at line 131 of file gui_win32.cpp.
int mouse_buttons = 3 [static] |
Definition at line 138 of file gui_win32.cpp.
BOOL mouseCaptureMode [static] |
Definition at line 135 of file gui_win32.cpp.
BOOL mouseCaptureNew [static] |
Definition at line 135 of file gui_win32.cpp.
BOOL mouseToggleReq [static] |
Definition at line 135 of file gui_win32.cpp.
int ms_lastx = 0 [static] |
Definition at line 133 of file gui_win32.cpp.
int ms_lasty = 0 [static] |
Definition at line 133 of file gui_win32.cpp.
Referenced by cursorWarped(), processMouseXY(), and resetDelta().
int ms_savedx = 0 [static] |
Definition at line 134 of file gui_win32.cpp.
int ms_savedy = 0 [static] |
Definition at line 134 of file gui_win32.cpp.
Referenced by cursorWarped(), processMouseXY(), and resetDelta().
int ms_xdelta = 0 [static] |
Definition at line 132 of file gui_win32.cpp.
int ms_ydelta = 0 [static] |
Definition at line 132 of file gui_win32.cpp.
Referenced by enq_mouse_event(), processMouseXY(), and resetDelta().
int ms_zdelta = 0 [static] |
Definition at line 132 of file gui_win32.cpp.
Referenced by enq_mouse_event(), processMouseXY(), and resetDelta().
unsigned prev_cursor_x = 0 [static] |
unsigned prev_cursor_y = 0 [static] |
BOOL queryFullScreen = false [static] |
Definition at line 150 of file gui_win32.cpp.
HWND saveParent = NULL [static] |
Definition at line 171 of file gui_win32.cpp.
Definition at line 190 of file gui_win32.cpp.
unsigned stretch_factor = 1 [static] |
Definition at line 167 of file gui_win32.cpp.
unsigned stretched_x [static] |
Definition at line 166 of file gui_win32.cpp.
unsigned stretched_y [static] |
Definition at line 166 of file gui_win32.cpp.
char szAppName[] = "ES40 Emulator" [static] |
Definition at line 173 of file gui_win32.cpp.
char szWindowName[] = "ES40 Emulator" [static] |
Definition at line 174 of file gui_win32.cpp.
unsigned tail = 0 [static] |
Definition at line 130 of file gui_win32.cpp.
Referenced by deq_key_event(), CKeyboard::enQ(), CKeyboard::enQ_imm(), enq_key_event(), enq_mouse_event(), bx_win32_gui_c::handle_events(), and CKeyboard::mouse_enQ().
unsigned int text_cols = 80 [static] |
Definition at line 158 of file gui_win32.cpp.
Referenced by bx_sdl_gui_c::dimension_update(), bx_x11_gui_c::dimension_update(), bx_win32_gui_c::dimension_update(), bx_x11_gui_c::specific_init(), bx_sdl_gui_c::text_update(), bx_x11_gui_c::text_update(), and bx_win32_gui_c::text_update().
u8 text_pal_idx[16] [static] |
Definition at line 159 of file gui_win32.cpp.
unsigned int text_rows = 25 [static] |
Definition at line 158 of file gui_win32.cpp.
Referenced by bx_sdl_gui_c::dimension_update(), and bx_sdl_gui_c::text_update().
bx_win32_gui_c* theGui = NULL [static] |
Definition at line 103 of file gui_win32.cpp.
RECT updated_area [static] |
Definition at line 146 of file gui_win32.cpp.
BOOL updated_area_valid = false [static] |
Definition at line 147 of file gui_win32.cpp.
Definition at line 161 of file gui_win32.cpp.
Referenced by bx_sdl_gui_c::text_update(), bx_x11_gui_c::text_update(), and bx_win32_gui_c::text_update().
HBITMAP vgafont[256] [static] |
Definition at line 156 of file gui_win32.cpp.
| u32 win32_to_bx_key[2][0x100] |
Definition at line 204 of file gui_win32.cpp.
unsigned long workerThread = 0 [static] |
Definition at line 136 of file gui_win32.cpp.
DWORD workerThreadID = 0 [static] |
Definition at line 137 of file gui_win32.cpp.
unsigned x_tilesize = 0 [static] |
Definition at line 141 of file gui_win32.cpp.
int xChar = 8 [static] |
Definition at line 157 of file gui_win32.cpp.
unsigned y_tilesize = 0 [static] |
Definition at line 141 of file gui_win32.cpp.
Referenced by bx_win32_gui_c::graphics_tile_update(), and bx_win32_gui_c::specific_init().
int yChar = 16 [static] |
Definition at line 157 of file gui_win32.cpp.
Referenced by bx_win32_gui_c::dimension_update(), and bx_win32_gui_c::text_update().