Added the 3Com 3C503 Network card;
Several bug fixes; Preliminar addition of the SDL 2 renderer (does not yet work correctly in full screen mode); SCSI devices no longer have configurable LUN's (this matches the configurability of real SCSI devices); SCSI LUN's are now handed by the device's handler; Removed all unused strings; Removed some unused code files; Significantly rewrote the bus mouse emulation.
This commit is contained in:
289
src/win/86Box.rc
289
src/win/86Box.rc
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Application resource script for Windows.
|
||||
*
|
||||
* Version: @(#)86Box.rc 1.0.36 2018/05/01
|
||||
* Version: @(#)86Box.rc 1.0.37 2018/05/25
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -34,7 +34,7 @@
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#pragma code_page(65001)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -66,11 +66,9 @@ BEGIN
|
||||
BEGIN
|
||||
MENUITEM "&DirectDraw", IDM_VID_DDRAW
|
||||
MENUITEM "Direct&3D 9", IDM_VID_D3D
|
||||
MENUITEM "&SDL", IDM_VID_SDL
|
||||
#ifdef USE_VNC
|
||||
MENUITEM "&VNC", IDM_VID_VNC
|
||||
#endif
|
||||
#ifdef USE_RDP
|
||||
MENUITEM "&RDP", IDM_VID_RDP
|
||||
#endif
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
@@ -325,7 +323,7 @@ BEGIN
|
||||
#endif
|
||||
END
|
||||
|
||||
DLG_CFG_VIDEO DIALOG DISCARDABLE 97, 0, 267, 63
|
||||
DLG_CFG_VIDEO DIALOG DISCARDABLE 97, 0, 267, 45
|
||||
STYLE DS_CONTROL | WS_CHILD
|
||||
FONT 9, "Segoe UI"
|
||||
BEGIN
|
||||
@@ -333,12 +331,9 @@ BEGIN
|
||||
COMBOBOX IDC_COMBO_VIDEO,71,7,140,120,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Configure",IDC_CONFIGURE_VID,214,7,46,12
|
||||
COMBOBOX IDC_COMBO_VIDEO_SPEED,71,25,189,120,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Video speed:",IDT_1708,7,26,58,10
|
||||
CONTROL "Voodoo Graphics",IDC_CHECK_VOODOO,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,45,199,10
|
||||
PUSHBUTTON "Configure",IDC_BUTTON_VOODOO,214,44,46,12
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,27,199,10
|
||||
PUSHBUTTON "Configure",IDC_BUTTON_VOODOO,214,26,46,12
|
||||
END
|
||||
|
||||
DLG_CFG_INPUT DIALOG DISCARDABLE 97, 0, 267, 65
|
||||
@@ -476,12 +471,9 @@ BEGIN
|
||||
COMBOBOX IDC_COMBO_HD_CHANNEL,170,117,90,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Channel:",IDT_1722,131,119,38,8
|
||||
COMBOBOX IDC_COMBO_HD_ID,170,117,22,12,CBS_DROPDOWNLIST |
|
||||
COMBOBOX IDC_COMBO_HD_ID,170,117,90,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "ID:",IDT_1723,131,119,38,8
|
||||
COMBOBOX IDC_COMBO_HD_LUN,239,117,22,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "LUN:",IDT_1724,200,119,38,8
|
||||
COMBOBOX IDC_COMBO_HD_CHANNEL_IDE,170,117,90,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
@@ -513,12 +505,9 @@ BEGIN
|
||||
COMBOBOX IDC_COMBO_HD_CHANNEL,134,71,77,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Channel:",IDT_1722,99,73,34,8
|
||||
COMBOBOX IDC_COMBO_HD_ID,133,71,26,12,CBS_DROPDOWNLIST |
|
||||
COMBOBOX IDC_COMBO_HD_ID,134,71,77,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "ID:",IDT_1723,117,73,15,8
|
||||
COMBOBOX IDC_COMBO_HD_LUN,185,71,26,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "LUN:",IDT_1724,168,73,15,8
|
||||
LTEXT "ID:",IDT_1723,99,73,34,8
|
||||
COMBOBOX IDC_COMBO_HD_CHANNEL_IDE,134,71,77,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Progress:",IDT_1752,7,7,204,9
|
||||
@@ -554,15 +543,12 @@ BEGIN
|
||||
COMBOBOX IDC_COMBO_CD_BUS,33,85,90,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Bus:",IDT_1740,7,87,24,8
|
||||
COMBOBOX IDC_COMBO_CD_ID,170,85,22,12,CBS_DROPDOWNLIST |
|
||||
COMBOBOX IDC_COMBO_CD_ID,170,85,90,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "ID:",IDT_1741,131,87,38,8
|
||||
COMBOBOX IDC_COMBO_CD_LUN,239,85,22,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "LUN:",IDT_1742,200,87,38,8
|
||||
COMBOBOX IDC_COMBO_CD_CHANNEL_IDE,170,85,90,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Channel:",IDT_1743,131,87,38,8
|
||||
LTEXT "Channel:",IDT_1742,131,87,38,8
|
||||
COMBOBOX IDC_COMBO_CD_SPEED,33,105,90,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Speed:",IDT_1758,7,107,24,8
|
||||
@@ -570,20 +556,17 @@ BEGIN
|
||||
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER |
|
||||
WS_TABSTOP,7,137,253,60
|
||||
LTEXT "ZIP drives:",IDT_1759,7,127,50,8
|
||||
COMBOBOX IDC_COMBO_ZIP_BUS,73,204,90,12,CBS_DROPDOWNLIST |
|
||||
COMBOBOX IDC_COMBO_ZIP_BUS,23,204,90,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Bus:",IDT_1753,57,206,14,8
|
||||
COMBOBOX IDC_COMBO_ZIP_ID,190,204,22,12,CBS_DROPDOWNLIST |
|
||||
LTEXT "Bus:",IDT_1753,7,206,14,8
|
||||
COMBOBOX IDC_COMBO_ZIP_ID,139,204,61,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "ID:",IDT_1754,171,206,18,8
|
||||
COMBOBOX IDC_COMBO_ZIP_LUN,239,204,22,12,CBS_DROPDOWNLIST |
|
||||
LTEXT "ID:",IDT_1754,120,206,28,8
|
||||
COMBOBOX IDC_COMBO_ZIP_CHANNEL_IDE,149,204,61,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "LUN:",IDT_1755,220,206,18,8
|
||||
COMBOBOX IDC_COMBO_ZIP_CHANNEL_IDE,200,204,60,12,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Channel:",IDT_1756,171,206,28,8
|
||||
LTEXT "Channel:",IDT_1755,120,206,28,8
|
||||
CONTROL "ZIP 250",IDC_CHECK250,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,7,204,44,10
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,218,204,44,10
|
||||
END
|
||||
|
||||
|
||||
@@ -603,42 +586,42 @@ END
|
||||
// remains consistent on all systems.
|
||||
#ifdef RELEASE_BUILD
|
||||
/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC_256x256.png */
|
||||
100 ICON DISCARDABLE "win/icons/86Box-RB.ico"
|
||||
10 ICON DISCARDABLE "win/icons/86Box-RB.ico"
|
||||
#else
|
||||
/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC2_256x256.png */
|
||||
100 ICON DISCARDABLE "win/icons/86Box.ico"
|
||||
10 ICON DISCARDABLE "win/icons/86Box.ico"
|
||||
#endif
|
||||
128 ICON DISCARDABLE "win/icons/floppy_525.ico"
|
||||
129 ICON DISCARDABLE "win/icons/floppy_525_active.ico"
|
||||
144 ICON DISCARDABLE "win/icons/floppy_35.ico"
|
||||
145 ICON DISCARDABLE "win/icons/floppy_35_active.ico"
|
||||
160 ICON DISCARDABLE "win/icons/cdrom.ico"
|
||||
161 ICON DISCARDABLE "win/icons/cdrom_active.ico"
|
||||
176 ICON DISCARDABLE "win/icons/zip.ico"
|
||||
177 ICON DISCARDABLE "win/icons/zip_active.ico"
|
||||
192 ICON DISCARDABLE "win/icons/hard_disk.ico"
|
||||
193 ICON DISCARDABLE "win/icons/hard_disk_active.ico"
|
||||
208 ICON DISCARDABLE "win/icons/network.ico"
|
||||
209 ICON DISCARDABLE "win/icons/network_active.ico"
|
||||
256 ICON DISCARDABLE "win/icons/machine.ico"
|
||||
257 ICON DISCARDABLE "win/icons/display.ico"
|
||||
258 ICON DISCARDABLE "win/icons/input_devices.ico"
|
||||
259 ICON DISCARDABLE "win/icons/sound.ico"
|
||||
261 ICON DISCARDABLE "win/icons/ports.ico"
|
||||
262 ICON DISCARDABLE "win/icons/other_peripherals.ico"
|
||||
264 ICON DISCARDABLE "win/icons/floppy_drives.ico"
|
||||
265 ICON DISCARDABLE "win/icons/other_removable_devices.ico"
|
||||
384 ICON DISCARDABLE "win/icons/floppy_525_empty.ico"
|
||||
385 ICON DISCARDABLE "win/icons/floppy_525_empty_active.ico"
|
||||
400 ICON DISCARDABLE "win/icons/floppy_35_empty.ico"
|
||||
401 ICON DISCARDABLE "win/icons/floppy_35_empty_active.ico"
|
||||
416 ICON DISCARDABLE "win/icons/cdrom_empty.ico"
|
||||
417 ICON DISCARDABLE "win/icons/cdrom_empty_active.ico"
|
||||
432 ICON DISCARDABLE "win/icons/zip_empty.ico"
|
||||
433 ICON DISCARDABLE "win/icons/zip_empty_active.ico"
|
||||
512 ICON DISCARDABLE "win/icons/floppy_disabled.ico"
|
||||
514 ICON DISCARDABLE "win/icons/cdrom_disabled.ico"
|
||||
515 ICON DISCARDABLE "win/icons/zip_disabled.ico"
|
||||
16 ICON DISCARDABLE "win/icons/floppy_525.ico"
|
||||
17 ICON DISCARDABLE "win/icons/floppy_525_active.ico"
|
||||
24 ICON DISCARDABLE "win/icons/floppy_35.ico"
|
||||
25 ICON DISCARDABLE "win/icons/floppy_35_active.ico"
|
||||
32 ICON DISCARDABLE "win/icons/cdrom.ico"
|
||||
33 ICON DISCARDABLE "win/icons/cdrom_active.ico"
|
||||
48 ICON DISCARDABLE "win/icons/zip.ico"
|
||||
49 ICON DISCARDABLE "win/icons/zip_active.ico"
|
||||
64 ICON DISCARDABLE "win/icons/hard_disk.ico"
|
||||
65 ICON DISCARDABLE "win/icons/hard_disk_active.ico"
|
||||
80 ICON DISCARDABLE "win/icons/network.ico"
|
||||
81 ICON DISCARDABLE "win/icons/network_active.ico"
|
||||
144 ICON DISCARDABLE "win/icons/floppy_525_empty.ico"
|
||||
145 ICON DISCARDABLE "win/icons/floppy_525_empty_active.ico"
|
||||
152 ICON DISCARDABLE "win/icons/floppy_35_empty.ico"
|
||||
153 ICON DISCARDABLE "win/icons/floppy_35_empty_active.ico"
|
||||
160 ICON DISCARDABLE "win/icons/cdrom_empty.ico"
|
||||
161 ICON DISCARDABLE "win/icons/cdrom_empty_active.ico"
|
||||
176 ICON DISCARDABLE "win/icons/zip_empty.ico"
|
||||
177 ICON DISCARDABLE "win/icons/zip_empty_active.ico"
|
||||
240 ICON DISCARDABLE "win/icons/machine.ico"
|
||||
241 ICON DISCARDABLE "win/icons/display.ico"
|
||||
242 ICON DISCARDABLE "win/icons/input_devices.ico"
|
||||
243 ICON DISCARDABLE "win/icons/sound.ico"
|
||||
244 ICON DISCARDABLE "win/icons/ports.ico"
|
||||
245 ICON DISCARDABLE "win/icons/other_peripherals.ico"
|
||||
246 ICON DISCARDABLE "win/icons/floppy_drives.ico"
|
||||
247 ICON DISCARDABLE "win/icons/other_removable_devices.ico"
|
||||
248 ICON DISCARDABLE "win/icons/floppy_disabled.ico"
|
||||
249 ICON DISCARDABLE "win/icons/cdrom_disabled.ico"
|
||||
250 ICON DISCARDABLE "win/icons/zip_disabled.ico"
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -720,7 +703,7 @@ BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 260
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 56
|
||||
BOTTOMMARGIN, 38
|
||||
END
|
||||
|
||||
DLG_CFG_INPUT, DIALOG
|
||||
@@ -801,17 +784,17 @@ BEGIN
|
||||
IDS_2049 "86Box Error"
|
||||
IDS_2050 "86Box Fatal Error"
|
||||
IDS_2051 "This will reset 86Box.\nAre you sure you want to save the settings?"
|
||||
IDS_2052 "DirectDraw Screenshot Error"
|
||||
IDS_2053 "Invalid number of sectors (valid values are between 1 and 63)"
|
||||
IDS_2054 "Invalid number of heads (valid values are between 1 and 16)"
|
||||
IDS_2055 "Invalid number of cylinders (valid values are between 1 and 266305)"
|
||||
IDS_2052 "Use CTRL+ALT+PAGE DOWN to return to windowed mode"
|
||||
IDS_2053 "Speed"
|
||||
IDS_2054 "ZIP %03i %i (%s): %ls"
|
||||
IDS_2055 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0"
|
||||
IDS_2056 "No usable ROM images found!"
|
||||
IDS_2057 "(empty)"
|
||||
IDS_2058 "(host drive %c:)"
|
||||
IDS_2058 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0All files (*.*)\0*.*\0"
|
||||
IDS_2059 "Turbo"
|
||||
IDS_2060 "On"
|
||||
IDS_2061 "Off"
|
||||
IDS_2062 "86Box was unable to find any ROMs.\nAt least one ROM set is required to use 86Box."
|
||||
IDS_2062 "All images (*.86F;*.DSK;*.FLP;*.IM?;*.*FD?)\0*.86F;*.DSK;*.FLP;*.IM?;*.*FD?\0Basic sector images (*.DSK;*.FLP;*.IM?;*.*FD?)\0*.DSK;*.FLP;*.IM?;*.IMG;*.*FD?\0Surface images (*.86F)\0*.86F\0"
|
||||
IDS_2063 "Configured ROM set not available.\nDefaulting to an available ROM set."
|
||||
END
|
||||
|
||||
@@ -829,7 +812,7 @@ BEGIN
|
||||
IDS_2073 "Floppy drives"
|
||||
IDS_2074 "Other removable devices"
|
||||
IDS_2075 "CD-ROM images (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0"
|
||||
IDS_2076 "Host CD/DVD Drive (%c:)"
|
||||
IDS_2076 "Surface images (*.86F)\0*.86F\0"
|
||||
IDS_2077 "Click to capture mouse"
|
||||
IDS_2078 "Press F8+F12 to release mouse"
|
||||
IDS_2079 "Press F8+F12 or middle button to release mouse"
|
||||
@@ -837,141 +820,67 @@ END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_2080 "Drive"
|
||||
IDS_2081 "Location"
|
||||
IDS_2080 "E&xport to 86F..."
|
||||
IDS_2081 "Unable to initialize FluidSynth, make sure you have the following libraries\nin your 86Box folder:\n\nlibfluidsynth.dll\nlibglib-2.0-0.dll\nlibiconv-2.dll\nlibintl-8.dll\nlibpcre-1.dll"
|
||||
IDS_2082 "Bus"
|
||||
IDS_2083 "File"
|
||||
IDS_2084 "C"
|
||||
IDS_2085 "H"
|
||||
IDS_2086 "S"
|
||||
IDS_2087 "MB"
|
||||
IDS_2088 "Unable to create bitmap file: %s"
|
||||
IDS_2089 "Enabled"
|
||||
IDS_2090 "Mute"
|
||||
IDS_2091 "Type"
|
||||
IDS_2092 "Bus"
|
||||
IDS_2093 "DMA"
|
||||
IDS_2088 "Check BPB"
|
||||
IDS_2089 "&Image..."
|
||||
IDS_2090 "&Reload previous image"
|
||||
IDS_2091 "E&mpty"
|
||||
IDS_2092 "&Mute"
|
||||
IDS_2093 "E&ject"
|
||||
IDS_2094 "KB"
|
||||
IDS_2095 "Neither DirectDraw nor Direct3D available !"
|
||||
IDS_2096 "&New image..."
|
||||
IDS_2097 "&Existing image..."
|
||||
IDS_2098 "Existing image (&Write-protected)..."
|
||||
IDS_2099 "Default"
|
||||
IDS_2100 "%i Wait state(s)"
|
||||
IDS_2101 "Type"
|
||||
IDS_2102 "PCap failed to set up because it may not be initialized"
|
||||
IDS_2103 "No PCap devices found"
|
||||
IDS_2104 "Invalid PCap device"
|
||||
IDS_2105 "Standard 2-button joystick(s)"
|
||||
IDS_2106 "Standard 4-button joystick"
|
||||
IDS_2107 "Standard 6-button joystick"
|
||||
IDS_2108 "Standard 8-button joystick"
|
||||
IDS_2109 "CH Flightstick Pro"
|
||||
IDS_2110 "Microsoft SideWinder Pad"
|
||||
IDS_2111 "Thrustmaster Flight Control System"
|
||||
IDS_2112 "None"
|
||||
IDS_2113 "Unable to load Keyboard Accelerators!"
|
||||
IDS_2114 "Unable to register Raw Input!"
|
||||
IDS_2115 "%u"
|
||||
IDS_2116 "%u MB (CHS: %i, %i, %i)"
|
||||
IDS_2117 "Floppy %i (%s): %ls"
|
||||
IDS_2118 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_2096 "Slave"
|
||||
IDS_2097 "SCSI (ID %s, LUN %s)"
|
||||
IDS_2098 "Adapter Type"
|
||||
IDS_2099 "Base Address"
|
||||
IDS_2100 "IRQ"
|
||||
IDS_2101 "8-bit DMA"
|
||||
IDS_2102 "16-bit DMA"
|
||||
IDS_2103 "BIOS"
|
||||
IDS_2104 "Network Type"
|
||||
IDS_2105 "Surround Module"
|
||||
IDS_2106 "MPU-401 Base Address"
|
||||
IDS_2107 "Use CTRL+ALT+PAGE DOWN to return to windowed mode"
|
||||
IDS_2108 "On-board RAM"
|
||||
IDS_2109 "Memory Size"
|
||||
IDS_2110 "Display Type"
|
||||
IDS_2111 "RGB"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_2112 "Composite"
|
||||
IDS_2113 "Composite Type"
|
||||
IDS_2114 "Old"
|
||||
IDS_2115 "New"
|
||||
IDS_2116 "RGB Type"
|
||||
IDS_2117 "Color"
|
||||
IDS_2118 "Monochrome (Green)"
|
||||
IDS_2119 "Monochrome (Amber)"
|
||||
IDS_2120 "Monochrome (Gray)"
|
||||
IDS_2121 "Color (no brown)"
|
||||
IDS_2122 "Monochrome (Default)"
|
||||
IDS_2123 "Snow Emulation"
|
||||
IDS_2124 "Bilinear Filtering"
|
||||
IDS_2125 "Dithering"
|
||||
IDS_2126 "Framebuffer Memory Size"
|
||||
IDS_2127 "Texture Memory Size"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_2128 "Screen Filter"
|
||||
IDS_2129 "Render Threads"
|
||||
IDS_2130 "Recompiler"
|
||||
IDS_2131 "Default"
|
||||
IDS_2132 "%i Wait state(s)"
|
||||
IDS_2133 "8-bit"
|
||||
IDS_2134 "Slow 16-bit"
|
||||
IDS_2135 "Fast 16-bit"
|
||||
IDS_2136 "Slow VLB/PCI"
|
||||
IDS_2137 "Mid VLB/PCI"
|
||||
IDS_2138 "Fast VLB/PCI"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_2139 "PCap failed to set up because it may not be initialized"
|
||||
IDS_2140 "No PCap devices found"
|
||||
IDS_2141 "Invalid PCap device"
|
||||
IDS_2142 "&Notify disk change"
|
||||
IDS_2143 "Type"
|
||||
IDS_2144 "Standard 2-button joystick(s)"
|
||||
IDS_2145 "Standard 4-button joystick"
|
||||
IDS_2146 "Standard 6-button joystick"
|
||||
IDS_2147 "Standard 8-button joystick"
|
||||
IDS_2148 "CH Flightstick Pro"
|
||||
IDS_2149 "Microsoft SideWinder Pad"
|
||||
IDS_2150 "Thrustmaster Flight Control System"
|
||||
IDS_2151 "Disabled"
|
||||
IDS_2152 "None"
|
||||
IDS_2153 "Unable to load Keyboard Accelerators!"
|
||||
IDS_2154 "Unable to register Raw Input!"
|
||||
IDS_2155 "IRQ %i"
|
||||
IDS_2156 "%u"
|
||||
IDS_2157 "%u MB (CHS: %i, %i, %i)"
|
||||
IDS_2158 "Floppy %i (%s): %ls"
|
||||
IDS_2159 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"
|
||||
IDS_2160 "Configuration files (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0"
|
||||
IDS_2161 "&New image..."
|
||||
IDS_2162 "&Existing image..."
|
||||
IDS_2163 "Existing image (&Write-protected)..."
|
||||
IDS_2164 "E&ject"
|
||||
IDS_2165 "&Mute"
|
||||
IDS_2166 "E&mpty"
|
||||
IDS_2167 "&Reload previous image"
|
||||
IDS_2168 "&Image..."
|
||||
IDS_2169 "Image (&Write-protected)..."
|
||||
IDS_2170 "Check BPB"
|
||||
IDS_2171 "Unable to initialize FluidSynth, make sure you have the following libraries\nin your 86Box folder:\n\nlibfluidsynth.dll\nlibglib-2.0-0.dll\nlibiconv-2.dll\nlibintl-8.dll\nlibpcre-1.dll"
|
||||
IDS_2172 "E&xport to 86F..."
|
||||
IDS_2173 "Surface images (*.86F)\0*.86F\0"
|
||||
IDS_2174 "All images (*.86F;*.DSK;*.FLP;*.IM?;*.*FD?)\0*.86F;*.DSK;*.FLP;*.IM?;*.*FD?\0Basic sector images (*.DSK;*.FLP;*.IM?;*.*FD?)\0*.DSK;*.FLP;*.IM?;*.IMG;*.*FD?\0Surface images (*.86F)\0*.86F\0"
|
||||
IDS_2175 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0All files (*.*)\0*.*\0"
|
||||
IDS_2176 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0"
|
||||
IDS_2177 "ZIP %03i %i (%s): %ls"
|
||||
IDS_2178 "Speed"
|
||||
|
||||
IDS_4096 "Hard disk (%s)"
|
||||
IDS_4097 "%01i:%01i"
|
||||
IDS_4098 "%i"
|
||||
IDS_4099 "Disabled"
|
||||
IDS_4099 "MFM/RLL or ESDI CD-ROM drives never existed"
|
||||
IDS_4100 "Custom..."
|
||||
IDS_4101 "Custom (large)..."
|
||||
IDS_4102 "Add New Hard Disk"
|
||||
IDS_4103 "Add Existing Hard Disk"
|
||||
IDS_4104 "Attempting to create a HDI image larger than 4 GB"
|
||||
IDS_4105 "Attempting to create a spuriously large hard disk image"
|
||||
IDS_4105 "Attempting to create a hard disk image beyond the 28-bit LBA limit"
|
||||
IDS_4106 "Hard disk images (*.HD?;*.IM?;*.VHD)\0*.HD?;*.IM?;*.VHD\0All files (*.*)\0*.*\0"
|
||||
IDS_4107 "Unable to open the file for read"
|
||||
IDS_4108 "Unable to open the file for write"
|
||||
IDS_4109 "HDI or HDX image with a sector size that is not 512 are not supported"
|
||||
IDS_4109 "HDI or HDX images with a sector size that is not 512 are not supported"
|
||||
IDS_4110 "USB is not yet supported"
|
||||
IDS_4111 "This image exists and will be overwritten.\nAre you sure you want to use it?"
|
||||
IDS_4112 "Please enter a valid file name"
|
||||
IDS_4113 "Remember to partition and format the new drive"
|
||||
IDS_4114 "MFM/RLL or ESDI CD-ROM drives never existed"
|
||||
|
||||
IDS_4352 "MFM/RLL"
|
||||
IDS_4353 "XTA"
|
||||
@@ -983,23 +892,17 @@ BEGIN
|
||||
IDS_4609 "XTA (%01i:%01i)"
|
||||
IDS_4610 "ESDI (%01i:%01i)"
|
||||
IDS_4611 "IDE (%01i:%01i)"
|
||||
IDS_4612 "SCSI (%02i:%02i)"
|
||||
IDS_4612 "SCSI (ID %02i)"
|
||||
|
||||
IDS_5120 "CD-ROM %i (%s): %s"
|
||||
|
||||
IDS_5376 "Disabled"
|
||||
IDS_5377 "<Reserved>"
|
||||
IDS_5378 "<Reserved>"
|
||||
IDS_5379 "<Reserved>"
|
||||
IDS_5380 "ATAPI"
|
||||
IDS_5381 "SCSI"
|
||||
|
||||
IDS_5632 "Disabled"
|
||||
IDS_5633 "<Reserved>"
|
||||
IDS_5634 "<Reserved>"
|
||||
IDS_5635 "<Reserved>"
|
||||
IDS_5636 "ATAPI (%01i:%01i)"
|
||||
IDS_5637 "SCSI (%02i:%02i)"
|
||||
IDS_5637 "SCSI (ID %02i)"
|
||||
|
||||
IDS_5888 "160 kB"
|
||||
IDS_5889 "180 kB"
|
||||
@@ -1047,7 +950,7 @@ VS_VERSION_INFO VERSIONINFO
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BLOCK "0409fde9"
|
||||
BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "IRC #SoftHistory\0"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# Makefile for Win32 (MinGW32) environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.117 2018/05/21
|
||||
# Version: @(#)Makefile.mingw 1.0.118 2018/05/26
|
||||
#
|
||||
# Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
# Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -291,7 +291,7 @@ ifneq ($(WX), n)
|
||||
UIOBJ := wx_main.o wx_ui.o wx_stbar.o wx_render.o
|
||||
else
|
||||
UIOBJ := win_ui.o win_stbar.o \
|
||||
win_ddraw.o win_d3d.o \
|
||||
win_ddraw.o win_d3d.o win_sdl.o \
|
||||
win_dialog.o win_about.o \
|
||||
win_settings.o win_devconf.o win_snd_gain.o \
|
||||
win_new_floppy.o win_jsconf.o
|
||||
@@ -489,7 +489,8 @@ NETOBJ := network.o \
|
||||
bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o \
|
||||
ip_input.o queue.o tcp_input.o debug.o ip_output.o \
|
||||
sbuf.o tcp_output.o udp.o if.o mbuf.o slirp.o tcp_subr.o \
|
||||
net_ne2000.o
|
||||
net_dp8390.o \
|
||||
net_3c503.o net_ne2000.o
|
||||
|
||||
SNDOBJ := sound.o \
|
||||
openal.o \
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Windows resource defines.
|
||||
*
|
||||
* Version: @(#)resource.h 1.0.24 2018/04/26
|
||||
* Version: @(#)resource.h 1.0.25 2018/05/25
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -48,7 +48,6 @@
|
||||
#define IDT_1705 1705 /* MB == IDC_TEXT_MB */
|
||||
#define IDT_1706 1706 /* Memory: */
|
||||
#define IDT_1707 1707 /* Video: */
|
||||
#define IDT_1708 1708 /* Video speed: */
|
||||
#define IDT_1709 1709 /* Mouse: */
|
||||
#define IDT_1710 1710 /* Joystick: */
|
||||
#define IDT_1711 1711 /* Sound card: */
|
||||
@@ -121,9 +120,8 @@
|
||||
|
||||
#define IDC_VIDEO 1030 /* video config */
|
||||
#define IDC_COMBO_VIDEO 1031
|
||||
#define IDC_COMBO_VIDEO_SPEED 1032
|
||||
#define IDC_CHECK_VOODOO 1033
|
||||
#define IDC_BUTTON_VOODOO 1034
|
||||
#define IDC_CHECK_VOODOO 1032
|
||||
#define IDC_BUTTON_VOODOO 1033
|
||||
|
||||
#define IDC_INPUT 1050 /* input config */
|
||||
#define IDC_COMBO_MOUSE 1051
|
||||
@@ -245,8 +243,8 @@
|
||||
#define IDM_VID_REMEMBER 40041
|
||||
#define IDM_VID_DDRAW 40050
|
||||
#define IDM_VID_D3D 40051
|
||||
#define IDM_VID_VNC 40052
|
||||
#define IDM_VID_RDP 40053
|
||||
#define IDM_VID_SDL 40052
|
||||
#define IDM_VID_VNC 40053
|
||||
#define IDM_VID_SCALE_1X 40054
|
||||
#define IDM_VID_SCALE_2X 40055
|
||||
#define IDM_VID_SCALE_3X 40056
|
||||
|
||||
100
src/win/win.c
100
src/win/win.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform main support module for Windows.
|
||||
*
|
||||
* Version: @(#)win.c 1.0.48 2018/04/29
|
||||
* Version: @(#)win.c 1.0.49 2018/05/25
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -41,15 +41,9 @@
|
||||
#ifdef USE_VNC
|
||||
# include "../vnc.h"
|
||||
#endif
|
||||
#ifdef USE_RDP
|
||||
# include "../rdp.h"
|
||||
#endif
|
||||
#ifdef USE_WX
|
||||
# include "../wx/wx_ui.h"
|
||||
#else
|
||||
# include "win_ddraw.h"
|
||||
# include "win_d3d.h"
|
||||
#endif
|
||||
# include "win_sdl.h"
|
||||
#include "win.h"
|
||||
|
||||
|
||||
@@ -87,43 +81,25 @@ static struct {
|
||||
void (*close)(void);
|
||||
void (*resize)(int x, int y);
|
||||
int (*pause)(void);
|
||||
} vid_apis[2][4] = {
|
||||
} vid_apis[2][RENDERERS_NUM] = {
|
||||
{
|
||||
#ifdef USE_WX
|
||||
{ "WxWidgets", 1, wx_init, wx_close, NULL, wx_pause },
|
||||
{ "WxWidgets", 1, wx_init, wx_close, NULL, wx_pause },
|
||||
#else
|
||||
{ "DDraw", 1, (int(*)(void*))ddraw_init, ddraw_close, NULL, ddraw_pause },
|
||||
{ "D3D", 1, (int(*)(void*))d3d_init, d3d_close, d3d_resize, d3d_pause },
|
||||
#endif
|
||||
#ifdef USE_VNC
|
||||
{ "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause },
|
||||
{ "SDL", 1, (int(*)(void*))sdl_init, sdl_close, NULL, sdl_pause },
|
||||
{ "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause }
|
||||
#else
|
||||
{ NULL, 0, NULL, NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef USE_RDP
|
||||
{ "RDP", 0, rdp_init, rdp_close, rdp_resize, rdp_pause }
|
||||
#else
|
||||
{ NULL, 0, NULL, NULL, NULL, NULL }
|
||||
{ "SDL", 1, (int(*)(void*))sdl_init, sdl_close, NULL, sdl_pause }
|
||||
#endif
|
||||
},
|
||||
{
|
||||
#ifdef USE_WX
|
||||
{ "WxWidgets", 1, wx_init, wx_close, NULL, wx_pause },
|
||||
{ "WxWidgets", 1, wx_init, wx_close, NULL, wx_pause },
|
||||
#else
|
||||
{ "DDraw", 1, (int(*)(void*))ddraw_init_fs, ddraw_close, NULL, ddraw_pause },
|
||||
{ "D3D", 1, (int(*)(void*))d3d_init_fs, d3d_close, NULL, d3d_pause },
|
||||
#endif
|
||||
#ifdef USE_VNC
|
||||
{ "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause },
|
||||
{ "SDL", 1, (int(*)(void*))sdl_init_fs, sdl_close, NULL, sdl_pause },
|
||||
{ "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause }
|
||||
#else
|
||||
{ NULL, 0, NULL, NULL, NULL, NULL },
|
||||
#endif
|
||||
#ifdef USE_RDP
|
||||
{ "RDP", 0, rdp_init, rdp_close, rdp_resize, rdp_pause }
|
||||
#else
|
||||
{ NULL, 0, NULL, NULL, NULL, NULL }
|
||||
{ "SDL", 1, (int(*)(void*))sdl_init_fs, sdl_close, sdl_resize, sdl_pause }
|
||||
#endif
|
||||
},
|
||||
};
|
||||
@@ -180,11 +156,15 @@ LoadCommonStrings(void)
|
||||
for (i=0; i<STR_NUM_5120; i++)
|
||||
LoadString(hinstance, 5120+i, lpRCstr5120[i].str, 512);
|
||||
|
||||
for (i=0; i<STR_NUM_5376; i++)
|
||||
LoadString(hinstance, 5376+i, lpRCstr5376[i].str, 512);
|
||||
for (i=0; i<STR_NUM_5376; i++) {
|
||||
if ((i == 0) || (i > 3))
|
||||
LoadString(hinstance, 5376+i, lpRCstr5376[i].str, 512);
|
||||
}
|
||||
|
||||
for (i=0; i<STR_NUM_5632; i++)
|
||||
LoadString(hinstance, 5632+i, lpRCstr5632[i].str, 512);
|
||||
for (i=0; i<STR_NUM_5632; i++) {
|
||||
if ((i == 0) || (i > 3))
|
||||
LoadString(hinstance, 5632+i, lpRCstr5632[i].str, 512);
|
||||
}
|
||||
|
||||
for (i=0; i<STR_NUM_5888; i++)
|
||||
LoadString(hinstance, 5888+i, lpRCstr5888[i].str, 512);
|
||||
@@ -250,7 +230,6 @@ plat_get_string(int i)
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_WX
|
||||
/* Create a console if we don't already have one. */
|
||||
static void
|
||||
CreateConsole(int init)
|
||||
@@ -405,7 +384,6 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
|
||||
|
||||
return(i);
|
||||
}
|
||||
#endif /*USE_WX*/
|
||||
|
||||
|
||||
/*
|
||||
@@ -607,7 +585,7 @@ plat_vidapi(char *name)
|
||||
|
||||
if (!strcasecmp(name, "default") || !strcasecmp(name, "system")) return(0);
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
for (i = 0; i < RENDERERS_NUM; i++) {
|
||||
if (vid_apis[0][i].name &&
|
||||
!strcasecmp(vid_apis[0][i].name, name)) return(i);
|
||||
}
|
||||
@@ -635,16 +613,15 @@ plat_vidapi_name(int api)
|
||||
name = "d3d";
|
||||
break;
|
||||
|
||||
#ifdef USE_VNC
|
||||
case 2:
|
||||
name = "sdl";
|
||||
break;
|
||||
|
||||
#ifdef USE_VNC
|
||||
case 3:
|
||||
name = "vnc";
|
||||
break;
|
||||
|
||||
#endif
|
||||
#ifdef USE_RDP
|
||||
case 3:
|
||||
name = "rdp";
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -663,25 +640,15 @@ plat_setvid(int api)
|
||||
|
||||
/* Close the (old) API. */
|
||||
vid_apis[0][vid_api].close();
|
||||
//#ifdef USE_WX
|
||||
// ui_check_menu_item(IDM_View_WX+vid_api, 0);
|
||||
//#endif
|
||||
vid_api = api;
|
||||
|
||||
#ifndef USE_WX
|
||||
if (vid_apis[0][vid_api].local)
|
||||
ShowWindow(hwndRender, SW_SHOW);
|
||||
else
|
||||
ShowWindow(hwndRender, SW_HIDE);
|
||||
#endif
|
||||
|
||||
/* Initialize the (new) API. */
|
||||
#ifdef USE_WX
|
||||
// ui_check_menu_item(IDM_View_WX+vid_api, 1);
|
||||
i = vid_apis[0][vid_api].init(NULL);
|
||||
#else
|
||||
i = vid_apis[0][vid_api].init((void *)hwndRender);
|
||||
#endif
|
||||
endblit();
|
||||
if (! i) return(0);
|
||||
|
||||
@@ -726,7 +693,7 @@ plat_setfullscreen(int on)
|
||||
|
||||
if (on && video_fullscreen_first) {
|
||||
video_fullscreen_first = 0;
|
||||
ui_msgbox(MBX_INFO, (wchar_t *)IDS_2107);
|
||||
ui_msgbox(MBX_INFO, (wchar_t *)IDS_2052);
|
||||
}
|
||||
|
||||
/* OK, claim the video. */
|
||||
@@ -741,10 +708,6 @@ plat_setfullscreen(int on)
|
||||
hw = (video_fullscreen) ? &hwndMain : &hwndRender;
|
||||
vid_apis[video_fullscreen][vid_api].init((void *) *hw);
|
||||
|
||||
#ifdef USE_WX
|
||||
wx_set_fullscreen(on);
|
||||
#endif
|
||||
|
||||
win_mouse_init();
|
||||
|
||||
/* Release video and make it redraw the screen. */
|
||||
@@ -765,7 +728,7 @@ take_screenshot(void)
|
||||
time_t now;
|
||||
|
||||
win_log("Screenshot: video API is: %i\n", vid_api);
|
||||
if ((vid_api < 0) || (vid_api > 1)) return;
|
||||
if ((vid_api < 0) || (vid_api > 2)) return;
|
||||
|
||||
memset(fn, 0, sizeof(fn));
|
||||
memset(path, 0, sizeof(path));
|
||||
@@ -784,12 +747,6 @@ take_screenshot(void)
|
||||
wcscat(path, fn);
|
||||
|
||||
switch(vid_api) {
|
||||
#ifdef USE_WX
|
||||
case 0:
|
||||
case 1:
|
||||
wx_screenshot(path);
|
||||
break;
|
||||
#else
|
||||
case 0: /* ddraw */
|
||||
ddraw_take_screenshot(path);
|
||||
break;
|
||||
@@ -797,10 +754,13 @@ take_screenshot(void)
|
||||
case 1: /* d3d9 */
|
||||
d3d_take_screenshot(path);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 2: /* sdl */
|
||||
sdl_take_screenshot(path);
|
||||
break;
|
||||
|
||||
#ifdef USE_VNC
|
||||
case 2: /* vnc */
|
||||
case 3: /* vnc */
|
||||
vnc_take_screenshot(path);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Platform support defintions for Win32.
|
||||
*
|
||||
* Version: @(#)win.h 1.0.17 2018/04/26
|
||||
* Version: @(#)win.h 1.0.18 2018/05/26
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -41,6 +41,7 @@
|
||||
#define SUB_CLASS_NAME L"86BoxSubWnd"
|
||||
#define SB_CLASS_NAME L"86BoxStatusBar"
|
||||
#define SB_MENU_NAME L"StatusBarMenu"
|
||||
#define FS_CLASS_NAME L"86BoxFullScreen"
|
||||
|
||||
/* Application-specific window messages. */
|
||||
#define WM_RESETD3D WM_USER
|
||||
@@ -50,13 +51,19 @@
|
||||
#define WM_PAUSE 0x8890
|
||||
#define WM_SENDHWND 0x8891
|
||||
|
||||
#ifdef USE_VNC
|
||||
#define RENDERERS_NUM 4
|
||||
#else
|
||||
#define RENDERERS_NUM 3
|
||||
#endif
|
||||
|
||||
|
||||
extern HINSTANCE hinstance;
|
||||
extern HWND hwndMain,
|
||||
hwndRender;
|
||||
extern HANDLE ghMutex;
|
||||
extern LCID lang_id;
|
||||
extern HICON hIcon[512];
|
||||
extern HICON hIcon[256];
|
||||
|
||||
// extern int status_is_open;
|
||||
|
||||
@@ -111,6 +118,7 @@ extern int hard_disk_was_added(void);
|
||||
|
||||
/* Platform UI support functions. */
|
||||
extern int ui_init(int nCmdShow);
|
||||
extern void plat_set_input(HWND h);
|
||||
|
||||
|
||||
/* Functions in win_about.c: */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle the About dialog.
|
||||
*
|
||||
* Version: @(#)win_about.c 1.0.6 2018/03/28
|
||||
* Version: @(#)win_about.c 1.0.7 2018/06/02
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -45,7 +45,7 @@ AboutDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_INITDIALOG:
|
||||
plat_pause(1);
|
||||
h = GetDlgItem(hdlg, IDC_ABOUT_ICON);
|
||||
ih = LoadImage(hinstance,(PCTSTR)100,IMAGE_ICON,64,64,0);
|
||||
ih = LoadImage(hinstance,(PCTSTR)10,IMAGE_ICON,64,64,0);
|
||||
SendMessage(h, STM_SETIMAGE, (WPARAM)IMAGE_ICON,
|
||||
(LPARAM)ih);
|
||||
break;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle the platform-side of CDROM drives.
|
||||
*
|
||||
* Version: @(#)win_cdrom.c 1.0.7 2018/03/26
|
||||
* Version: @(#)win_cdrom.c 1.0.8 2018/06/02
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -29,9 +29,9 @@
|
||||
#include <wchar.h>
|
||||
#include "../config.h"
|
||||
#include "../disk/hdd.h"
|
||||
#include "../disk/zip.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../disk/zip.h"
|
||||
#include "../cdrom/cdrom_image.h"
|
||||
#include "../cdrom/cdrom_null.h"
|
||||
#include "../scsi/scsi_disk.h"
|
||||
@@ -121,10 +121,10 @@ cdrom_reload(uint8_t id)
|
||||
void
|
||||
zip_eject(uint8_t id)
|
||||
{
|
||||
zip_close(id);
|
||||
zip_disk_close(zip[id]);
|
||||
if (zip_drives[id].bus_type) {
|
||||
/* Signal disk change to the emulated machine. */
|
||||
zip_insert(id);
|
||||
zip_insert(zip[id]);
|
||||
}
|
||||
|
||||
ui_sb_update_icon_state(SB_ZIP | id, 1);
|
||||
@@ -138,7 +138,7 @@ zip_eject(uint8_t id)
|
||||
void
|
||||
zip_reload(uint8_t id)
|
||||
{
|
||||
zip_disk_reload(id);
|
||||
zip_disk_reload(zip[id]);
|
||||
if (wcslen(zip_drives[id].image_path) == 0) {
|
||||
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
|
||||
ui_sb_update_icon_state(SB_ZIP|id, 1);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Rendering module for Microsoft Direct3D 9.
|
||||
*
|
||||
* Version: @(#)win_d3d.cpp 1.0.10 2018/01/15
|
||||
* Version: @(#)win_d3d.cpp 1.0.11 2018/05/26
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -183,8 +183,14 @@ d3d_blit_fs(int x, int y, int y1, int y2, int w, int h)
|
||||
|
||||
hr = d3dTexture->LockRect(0, &dr, &lock_rect, 0);
|
||||
if (hr == D3D_OK) {
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
if (buffer32) memcpy((void *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4);
|
||||
for (yy = y1; yy < y2; yy++) {
|
||||
if (buffer32) {
|
||||
if (video_grayscale || invert_display)
|
||||
video_transform_copy((uint32_t *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w);
|
||||
else
|
||||
memcpy((void *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4);
|
||||
}
|
||||
}
|
||||
|
||||
video_blit_complete();
|
||||
d3dTexture->UnlockRect(0);
|
||||
@@ -288,9 +294,14 @@ d3d_blit(int x, int y, int y1, int y2, int w, int h)
|
||||
hr = d3dTexture->LockRect(0, &dr, &r, 0);
|
||||
if (hr == D3D_OK) {
|
||||
for (yy = y1; yy < y2; yy++) {
|
||||
if (buffer32)
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer32->h)
|
||||
memcpy((void *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4);
|
||||
if (buffer32) {
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer32->h) {
|
||||
if (video_grayscale || invert_display)
|
||||
video_transform_copy((uint32_t *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w);
|
||||
else
|
||||
memcpy((void *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
video_blit_complete();
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* NOTES: This code should be re-merged into a single init() with a
|
||||
* 'fullscreen' argument, indicating FS mode is requested.
|
||||
*
|
||||
* Version: @(#)win_ddraw.cpp 1.0.8 2018/04/29
|
||||
* Version: @(#)win_ddraw.cpp 1.0.9 2018/05/26
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -104,6 +104,10 @@ bgra_to_rgb(png_bytep *b_rgb, uint8_t *bgra, int width, int height)
|
||||
{
|
||||
int i, j;
|
||||
uint8_t *r, *b;
|
||||
uint32_t *rgb = (uint32_t *) bgra;
|
||||
|
||||
if (video_grayscale || invert_display)
|
||||
*bgra = video_color_transform(*bgra);
|
||||
|
||||
for (i = 0; i < height; i++) {
|
||||
for (j = 0; j < width; j++) {
|
||||
@@ -237,7 +241,7 @@ SavePNG(wchar_t *szFilename, HBITMAP hBitmap)
|
||||
|
||||
if (pBuf2) free(pBuf2);
|
||||
|
||||
if (pBuf) free(pBuf);
|
||||
if (pBuf) free(pBuf);
|
||||
|
||||
if (fp) fclose(fp);
|
||||
}
|
||||
@@ -374,8 +378,14 @@ ddraw_blit_fs(int x, int y, int y1, int y2, int w, int h)
|
||||
return;
|
||||
}
|
||||
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
if (buffer32) memcpy((void *)((uintptr_t)ddsd.lpSurface + (yy * ddsd.lPitch)), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4);
|
||||
for (yy = y1; yy < y2; yy++) {
|
||||
if (buffer32) {
|
||||
if (video_grayscale || invert_display)
|
||||
video_transform_copy((uint32_t *)((uintptr_t)ddsd.lpSurface + (yy * ddsd.lPitch)), &(((uint32_t *)buffer32->line[y + yy])[x]), w);
|
||||
else
|
||||
memcpy((void *)((uintptr_t)ddsd.lpSurface + (yy * ddsd.lPitch)), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4);
|
||||
}
|
||||
}
|
||||
video_blit_complete();
|
||||
lpdds_back->Unlock(NULL);
|
||||
|
||||
@@ -418,6 +428,7 @@ ddraw_blit(int x, int y, int y1, int y2, int w, int h)
|
||||
POINT po;
|
||||
HRESULT hr;
|
||||
int yy;
|
||||
uint32_t *p, *q;
|
||||
|
||||
if (lpdds_back == NULL) {
|
||||
video_blit_complete();
|
||||
@@ -447,10 +458,16 @@ ddraw_blit(int x, int y, int y1, int y2, int w, int h)
|
||||
}
|
||||
|
||||
for (yy = y1; yy < y2; yy++) {
|
||||
if (buffer32)
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer32->h)
|
||||
memcpy((uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4);
|
||||
if (buffer32) {
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer32->h) {
|
||||
if (video_grayscale || invert_display)
|
||||
video_transform_copy((uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]), &(((uint32_t *)buffer32->line[y + yy])[x]), w);
|
||||
else
|
||||
memcpy((uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
video_blit_complete();
|
||||
lpdds_back->Unlock(NULL);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Handle the New Floppy Image dialog.
|
||||
*
|
||||
* Version: @(#)win_new_floppy.c 1.0.7 2018/05/14
|
||||
* Version: @(#)win_new_floppy.c 1.0.8 2018/05/25
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "../plat.h"
|
||||
#include "../random.h"
|
||||
#include "../ui.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "../disk/zip.h"
|
||||
#include "win.h"
|
||||
|
||||
@@ -624,7 +625,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return TRUE;
|
||||
|
||||
case IDC_CFILE:
|
||||
if (!file_dlg_w(hdlg, plat_get_string(is_zip ? IDS_2176 : IDS_2174), L"", 1)) {
|
||||
if (!file_dlg_w(hdlg, plat_get_string(is_zip ? IDS_2055 : IDS_2062), L"", 1)) {
|
||||
if (!wcschr(wopenfilestring, L'.')) {
|
||||
if (wcslen(wopenfilestring) && (wcslen(wopenfilestring) <= 256)) {
|
||||
twcs = &wopenfilestring[wcslen(wopenfilestring)];
|
||||
|
||||
625
src/win/win_sdl.c
Normal file
625
src/win/win_sdl.c
Normal file
@@ -0,0 +1,625 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Rendering module for libSDL2
|
||||
*
|
||||
* NOTE: Given all the problems reported with FULLSCREEN use of SDL,
|
||||
* we will not use that, but, instead, use a new window which
|
||||
* coverrs the entire desktop.
|
||||
*
|
||||
* Version: @(#)win_sdl.c 1.0.0 2018/05/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Michael Dr<44>ing, <michael@drueing.de>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2018 Michael Dr<44>ing.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the entire
|
||||
* above notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names
|
||||
* of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#define UNICODE
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
#define PNG_DEBUG 0
|
||||
#include <png.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "../86box.h"
|
||||
#include "../device.h"
|
||||
#include "../plat.h"
|
||||
#include "../plat_dynld.h"
|
||||
#include "../video/video.h"
|
||||
#include "win.h"
|
||||
#include "win_sdl.h"
|
||||
|
||||
|
||||
#define PATH_SDL_DLL "sdl2.dll"
|
||||
|
||||
|
||||
static void *sdl_handle = NULL; /* handle to libSDL2 DLL */
|
||||
static SDL_Window *sdl_win = NULL;
|
||||
static SDL_Renderer *sdl_render = NULL;
|
||||
static SDL_Texture *sdl_tex = NULL;
|
||||
static HWND sdl_parent_hwnd = NULL;
|
||||
static HWND sdl_hwnd = NULL;
|
||||
static int sdl_w, sdl_h;
|
||||
static int sdl_fs;
|
||||
static int cur_w, cur_h;
|
||||
|
||||
static png_structp png_ptr;
|
||||
static png_infop info_ptr;
|
||||
|
||||
|
||||
/* Pointers to the real functions. */
|
||||
static void (*sdl_GetVersion)(SDL_version *ver);
|
||||
static char *const (*sdl_GetError)(void);
|
||||
static int (*sdl_Init)(Uint32 flags);
|
||||
static void (*sdl_Quit)(void);
|
||||
static SDL_Window *(*sdl_CreateWindowFrom)(const void *data);
|
||||
static void (*sdl_DestroyWindow)(SDL_Window *window);
|
||||
static SDL_Renderer *(*sdl_CreateRenderer)(SDL_Window *window,
|
||||
int index, Uint32 flags);
|
||||
static void (*sdl_DestroyRenderer)(SDL_Renderer *renderer);
|
||||
static SDL_Texture *(*sdl_CreateTexture)(SDL_Renderer *renderer,
|
||||
Uint32 format, int access,
|
||||
int w, int h);
|
||||
static void (*sdl_DestroyTexture)(SDL_Texture *texture);
|
||||
static int (*sdl_LockTexture)(SDL_Texture *texture,
|
||||
const SDL_Rect *rect,
|
||||
void **pixels, int *pitch);
|
||||
static void (*sdl_UnlockTexture)(SDL_Texture *texture);
|
||||
static int (*sdl_RenderCopy)(SDL_Renderer *renderer,
|
||||
SDL_Texture *texture,
|
||||
const SDL_Rect *srcrect,
|
||||
const SDL_Rect *dstrect);
|
||||
static void (*sdl_RenderPresent)(SDL_Renderer *renderer);
|
||||
static void (*sdl_GetWindowSize)(SDL_Window* window,
|
||||
int* w,
|
||||
int* h);
|
||||
static int (*sdl_RenderReadPixels)(SDL_Renderer* renderer,
|
||||
const SDL_Rect* rect,
|
||||
Uint32 format,
|
||||
void* pixels,
|
||||
int pitch);
|
||||
static SDL_bool (*sdl_SetHint)(const char* name,
|
||||
const char* value);
|
||||
|
||||
static dllimp_t sdl_imports[] = {
|
||||
{ "SDL_GetVersion", &sdl_GetVersion },
|
||||
{ "SDL_GetError", &sdl_GetError },
|
||||
{ "SDL_Init", &sdl_Init },
|
||||
{ "SDL_Quit", &sdl_Quit },
|
||||
{ "SDL_CreateWindowFrom", &sdl_CreateWindowFrom },
|
||||
{ "SDL_DestroyWindow", &sdl_DestroyWindow },
|
||||
{ "SDL_CreateRenderer", &sdl_CreateRenderer },
|
||||
{ "SDL_DestroyRenderer", &sdl_DestroyRenderer },
|
||||
{ "SDL_CreateTexture", &sdl_CreateTexture },
|
||||
{ "SDL_DestroyTexture", &sdl_DestroyTexture },
|
||||
{ "SDL_LockTexture", &sdl_LockTexture },
|
||||
{ "SDL_UnlockTexture", &sdl_UnlockTexture },
|
||||
{ "SDL_RenderCopy", &sdl_RenderCopy },
|
||||
{ "SDL_RenderPresent", &sdl_RenderPresent },
|
||||
{ "SDL_GetWindowSize", &sdl_GetWindowSize },
|
||||
{ "SDL_RenderReadPixels", &sdl_RenderReadPixels },
|
||||
{ "SDL_SetHint", &sdl_SetHint },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
||||
#ifdef ENABLE_SDL_LOG
|
||||
int sdl_do_log = ENABLE_SDL_LOG;
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
sdl_log(const char *fmt, ...)
|
||||
{
|
||||
#ifdef ENABLE_SDL_LOG
|
||||
va_list ap;
|
||||
|
||||
if (sdl_do_log) {
|
||||
va_start(ap, fmt);
|
||||
pclog_ex(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sdl_stretch(int *w, int *h, int *x, int *y)
|
||||
{
|
||||
double dw, dh, dx, dy, temp, temp2, ratio_w, ratio_h, gsr, hsr;
|
||||
|
||||
switch (video_fullscreen_scale) {
|
||||
case FULLSCR_SCALE_FULL:
|
||||
*w = sdl_w;
|
||||
*h = sdl_h;
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
break;
|
||||
case FULLSCR_SCALE_43:
|
||||
dw = (double) sdl_w;
|
||||
dh = (double) sdl_h;
|
||||
temp = (dh / 3.0) * 4.0;
|
||||
dx = (dw - temp) / 2.0;
|
||||
dw = temp;
|
||||
*w = (int) dw;
|
||||
*h = (int) dh;
|
||||
*x = (int) dx;
|
||||
*y = 0;
|
||||
break;
|
||||
case FULLSCR_SCALE_SQ:
|
||||
dw = (double) sdl_w;
|
||||
dh = (double) sdl_h;
|
||||
temp = ((double) *w);
|
||||
temp2 = ((double) *h);
|
||||
dx = (dw / 2.0) - ((dh * temp) / (temp2 * 2.0));
|
||||
dy = 0.0;
|
||||
if (dx < 0.0) {
|
||||
dx = 0.0;
|
||||
dy = (dw / 2.0) - ((dh * temp2) / (temp * 2.0));
|
||||
}
|
||||
dw -= (dx * 2.0);
|
||||
dh -= (dy * 2.0);
|
||||
*w = (int) dw;
|
||||
*h = (int) dh;
|
||||
*x = (int) dx;
|
||||
*y = (int) dy;
|
||||
break;
|
||||
case FULLSCR_SCALE_INT:
|
||||
dw = (double) sdl_w;
|
||||
dh = (double) sdl_h;
|
||||
temp = ((double) *w);
|
||||
temp2 = ((double) *h);
|
||||
ratio_w = dw / ((double) *w);
|
||||
ratio_h = dh / ((double) *h);
|
||||
if (ratio_h < ratio_w)
|
||||
ratio_w = ratio_h;
|
||||
dx = (dw / 2.0) - ((temp * ratio_w) / 2.0);
|
||||
dy = (dh / 2.0) - ((temp2 * ratio_h) / 2.0);
|
||||
dw -= (dx * 2.0);
|
||||
dh -= (dy * 2.0);
|
||||
*w = (int) dw;
|
||||
*h = (int) dh;
|
||||
*x = (int) dx;
|
||||
*y = (int) dy;
|
||||
break;
|
||||
case FULLSCR_SCALE_KEEPRATIO:
|
||||
dw = (double) sdl_w;
|
||||
dh = (double) sdl_h;
|
||||
hsr = dw / dh;
|
||||
gsr = ((double) *w) / ((double) *h);
|
||||
if (gsr <= hsr) {
|
||||
temp = dh * gsr;
|
||||
dx = (dw - temp) / 2.0;
|
||||
dw = temp;
|
||||
*w = (int) dw;
|
||||
*h = (int) dh;
|
||||
*x = (int) dx;
|
||||
*y = 0;
|
||||
} else {
|
||||
temp = dw / gsr;
|
||||
dy = (dh - temp) / 2.0;
|
||||
dh = temp;
|
||||
*w = (int) dw;
|
||||
*h = (int) dh;
|
||||
*x = 0;
|
||||
*y = (int) dy;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sdl_blit(int x, int y, int y1, int y2, int w, int h)
|
||||
{
|
||||
SDL_Rect r_src;
|
||||
void *pixeldata;
|
||||
int pitch;
|
||||
int yy, ret;
|
||||
|
||||
if (y1 == y2) {
|
||||
video_blit_complete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (buffer32 == NULL) {
|
||||
video_blit_complete();
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* SDL_UpdateTexture() might be better here, as it is
|
||||
* (reportedly) slightly faster.
|
||||
*/
|
||||
sdl_LockTexture(sdl_tex, 0, &pixeldata, &pitch);
|
||||
|
||||
for (yy = y1; yy < y2; yy++) {
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer32->h) {
|
||||
if (video_grayscale || invert_display)
|
||||
video_transform_copy((uint32_t *) &(((uint8_t *)pixeldata)[yy * pitch]), &(((uint32_t *)buffer32->line[y + yy])[x]), w);
|
||||
else
|
||||
memcpy((uint32_t *) &(((uint8_t *)pixeldata)[yy * pitch]), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4);
|
||||
}
|
||||
}
|
||||
|
||||
video_blit_complete();
|
||||
|
||||
sdl_UnlockTexture(sdl_tex);
|
||||
|
||||
if (sdl_fs) {
|
||||
pclog("sdl_blit(%i, %i, %i, %i, %i, %i) (%i, %i)\n", x, y, y1, y2, w, h, unscaled_size_x, efscrnsz_y);
|
||||
if (w == unscaled_size_x)
|
||||
sdl_resize(w, h);
|
||||
pclog("(%08X, %08X, %08X)\n", sdl_win, sdl_render, sdl_tex);
|
||||
}
|
||||
|
||||
r_src.x = 0;
|
||||
r_src.y = 0;
|
||||
r_src.w = w;
|
||||
r_src.h = h;
|
||||
|
||||
ret = sdl_RenderCopy(sdl_render, sdl_tex, &r_src, 0);
|
||||
if (ret)
|
||||
sdl_log("SDL: unable to copy texture to renderer (%s)\n", sdl_GetError());
|
||||
|
||||
sdl_RenderPresent(sdl_render);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sdl_close(void)
|
||||
{
|
||||
/* Unregister our renderer! */
|
||||
video_setblit(NULL);
|
||||
|
||||
if (sdl_tex != NULL) {
|
||||
sdl_DestroyTexture(sdl_tex);
|
||||
sdl_tex = NULL;
|
||||
}
|
||||
|
||||
if (sdl_render != NULL) {
|
||||
sdl_DestroyRenderer(sdl_render);
|
||||
sdl_render = NULL;
|
||||
}
|
||||
|
||||
if (sdl_win != NULL) {
|
||||
sdl_DestroyWindow(sdl_win);
|
||||
sdl_win = NULL;
|
||||
}
|
||||
|
||||
if (sdl_hwnd != NULL) {
|
||||
plat_set_input(hwndMain);
|
||||
|
||||
ShowWindow(hwndRender, TRUE);
|
||||
|
||||
SetFocus(hwndMain);
|
||||
|
||||
DestroyWindow(sdl_hwnd);
|
||||
sdl_hwnd = NULL;
|
||||
}
|
||||
|
||||
if (sdl_parent_hwnd != NULL) {
|
||||
DestroyWindow(sdl_parent_hwnd);
|
||||
sdl_parent_hwnd = NULL;
|
||||
}
|
||||
|
||||
/* Quit and unload the DLL if possible. */
|
||||
if (sdl_handle != NULL) {
|
||||
sdl_Quit();
|
||||
|
||||
dynld_close(sdl_handle);
|
||||
sdl_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int old_capture = 0;
|
||||
|
||||
|
||||
static int
|
||||
sdl_init_common(int fs)
|
||||
{
|
||||
wchar_t temp[128];
|
||||
SDL_version ver;
|
||||
int w, h, x, y;
|
||||
RECT rect;
|
||||
|
||||
sdl_log("SDL: init (fs=%d)\n", fs);
|
||||
|
||||
cgapal_rebuild();
|
||||
|
||||
/* Try loading the DLL. */
|
||||
sdl_handle = dynld_module(PATH_SDL_DLL, sdl_imports);
|
||||
if (sdl_handle == NULL) {
|
||||
sdl_log("SDL: unable to load '%s', SDL not available.\n", PATH_SDL_DLL);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Get and log the version of the DLL we are using. */
|
||||
sdl_GetVersion(&ver);
|
||||
sdl_log("SDL: version %d.%d.%d\n", ver.major, ver.minor, ver.patch);
|
||||
|
||||
/* Initialize the SDL system. */
|
||||
if (sdl_Init(SDL_INIT_VIDEO) < 0) {
|
||||
sdl_log("SDL: initialization failed (%s)\n", sdl_GetError());
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (fs) {
|
||||
/* Get the size of the (current) desktop. */
|
||||
sdl_w = GetSystemMetrics(SM_CXSCREEN);
|
||||
sdl_h = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
/* Create the desktop-covering window. */
|
||||
_swprintf(temp, L"%s v%s", EMU_NAME_W, EMU_VERSION_W);
|
||||
sdl_parent_hwnd = CreateWindow(SUB_CLASS_NAME,
|
||||
temp,
|
||||
WS_POPUP,
|
||||
0, 0, sdl_w, sdl_h,
|
||||
HWND_DESKTOP,
|
||||
NULL,
|
||||
hinstance,
|
||||
NULL);
|
||||
|
||||
SetWindowPos(sdl_parent_hwnd, HWND_TOPMOST,
|
||||
0, 0, sdl_w, sdl_h, SWP_SHOWWINDOW);
|
||||
|
||||
/* Create the actual rendering window. */
|
||||
_swprintf(temp, L"%s v%s", EMU_NAME_W, EMU_VERSION_W);
|
||||
sdl_hwnd = CreateWindow(SUB_CLASS_NAME,
|
||||
temp,
|
||||
WS_POPUP,
|
||||
0, 0, sdl_w, sdl_h,
|
||||
sdl_parent_hwnd,
|
||||
NULL,
|
||||
hinstance,
|
||||
NULL);
|
||||
sdl_log("SDL: FS %dx%d window at %08lx\n", sdl_w, sdl_h, sdl_hwnd);
|
||||
|
||||
/* Redirect RawInput to this new window. */
|
||||
plat_set_input(sdl_hwnd);
|
||||
|
||||
SetFocus(sdl_hwnd);
|
||||
|
||||
/* Show the window, make it topmost, and give it focus. */
|
||||
w = unscaled_size_x;
|
||||
h = efscrnsz_y;
|
||||
sdl_stretch(&w, &h, &x, &y);
|
||||
SetWindowPos(sdl_hwnd, sdl_parent_hwnd,
|
||||
x, y, w, h, SWP_SHOWWINDOW);
|
||||
|
||||
/* Now create the SDL window from that. */
|
||||
sdl_win = sdl_CreateWindowFrom((void *)sdl_hwnd);
|
||||
|
||||
old_capture = mouse_capture;
|
||||
|
||||
GetWindowRect(sdl_hwnd, &rect);
|
||||
|
||||
ClipCursor(&rect);
|
||||
|
||||
mouse_capture = 1;
|
||||
} else {
|
||||
/* Create the SDL window from the render window. */
|
||||
sdl_win = sdl_CreateWindowFrom((void *)hwndRender);
|
||||
|
||||
mouse_capture = old_capture;
|
||||
|
||||
if (mouse_capture) {
|
||||
GetWindowRect(hwndRender, &rect);
|
||||
|
||||
ClipCursor(&rect);
|
||||
}
|
||||
}
|
||||
if (sdl_win == NULL) {
|
||||
sdl_log("SDL: unable to CreateWindowFrom (%s)\n", sdl_GetError());
|
||||
sdl_close();
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* SDL_RENDERER_SOFTWARE, because SDL tries to do funky stuff
|
||||
* otherwise (it turns off Win7 Aero and it looks like it's
|
||||
* trying to switch to fullscreen even though the window is
|
||||
* not a fullscreen window?)
|
||||
*/
|
||||
sdl_render = sdl_CreateRenderer(sdl_win, -1, SDL_RENDERER_SOFTWARE);
|
||||
if (sdl_render == NULL) {
|
||||
sdl_log("SDL: unable to create renderer (%s)\n", sdl_GetError());
|
||||
sdl_close();
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* Actually the source is (apparently) XRGB8888, but the alpha
|
||||
* channel seems to be set to 255 everywhere, so ARGB8888 works
|
||||
* just as well.
|
||||
*/
|
||||
sdl_tex = sdl_CreateTexture(sdl_render, SDL_PIXELFORMAT_ARGB8888,
|
||||
SDL_TEXTUREACCESS_STREAMING, 2048, 2048);
|
||||
if (sdl_tex == NULL) {
|
||||
sdl_log("SDL: unable to create texture (%s)\n", sdl_GetError());
|
||||
sdl_close();
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Make sure we get a clean exit. */
|
||||
atexit(sdl_close);
|
||||
|
||||
/* Register our renderer! */
|
||||
video_setblit(sdl_blit);
|
||||
|
||||
sdl_fs = fs;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
sdl_init(HWND h)
|
||||
{
|
||||
return sdl_init_common(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
sdl_init_fs(HWND h)
|
||||
{
|
||||
return sdl_init_common(1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sdl_take_screenshot(const wchar_t *fn)
|
||||
{
|
||||
int i, res, x, y, width = 0, height = 0;
|
||||
unsigned char* rgba = NULL;
|
||||
png_bytep *b_rgb = NULL;
|
||||
FILE *fp = NULL;
|
||||
|
||||
sdl_GetWindowSize(sdl_win, &width, &height);
|
||||
|
||||
/* create file */
|
||||
fp = plat_fopen((wchar_t *) fn, (wchar_t *) L"wb");
|
||||
if (!fp) {
|
||||
sdl_log("[sdl_take_screenshot] File %ls could not be opened for writing", fn);
|
||||
return;
|
||||
}
|
||||
|
||||
/* initialize stuff */
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
|
||||
if (!png_ptr) {
|
||||
sdl_log("[sdl_take_screenshot] png_create_write_struct failed");
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (!info_ptr) {
|
||||
sdl_log("[sdl_take_screenshot] png_create_info_struct failed");
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
|
||||
png_init_io(png_ptr, fp);
|
||||
|
||||
png_set_IHDR(png_ptr, info_ptr, width, height,
|
||||
8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
if ((rgba = (unsigned char *)malloc(width * height * 4)) == NULL) {
|
||||
sdl_log("[sdl_take_screenshot] Unable to Allocate RGBA Bitmap Memory");
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
|
||||
res = sdl_RenderReadPixels(sdl_render, NULL, SDL_PIXELFORMAT_ABGR8888, rgba, width * 4);
|
||||
if (res) {
|
||||
sdl_log("[sdl_take_screenshot] Error reading render pixels\n");
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((b_rgb = (png_bytep *) malloc(sizeof(png_bytep) * height)) == NULL) {
|
||||
sdl_log("[sdl_take_screenshot] Unable to Allocate RGB Bitmap Memory");
|
||||
free(rgba);
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
|
||||
for (y = 0; y < height; ++y) {
|
||||
b_rgb[y] = (png_byte *) malloc(png_get_rowbytes(png_ptr, info_ptr));
|
||||
for (x = 0; x < width; ++x) {
|
||||
b_rgb[y][(x) * 3 + 0] = rgba[(y * width + x) * 4 + 0];
|
||||
b_rgb[y][(x) * 3 + 1] = rgba[(y * width + x) * 4 + 1];
|
||||
b_rgb[y][(x) * 3 + 2] = rgba[(y * width + x) * 4 + 2];
|
||||
}
|
||||
}
|
||||
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
|
||||
png_write_image(png_ptr, b_rgb);
|
||||
|
||||
png_write_end(png_ptr, NULL);
|
||||
|
||||
/* cleanup heap allocation */
|
||||
for (i = 0; i < height; i++)
|
||||
if (b_rgb[i]) free(b_rgb[i]);
|
||||
|
||||
if (b_rgb) free(b_rgb);
|
||||
|
||||
if (rgba) free(rgba);
|
||||
|
||||
if (fp) fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
sdl_pause(void)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sdl_resize(int x, int y)
|
||||
{
|
||||
int ww, wh, wx, wy;
|
||||
|
||||
if ((x == cur_w) && (y == cur_h))
|
||||
return;
|
||||
|
||||
pclog("sdl_resize(%i, %i)\n", x, y);
|
||||
ww = x;
|
||||
wh = y;
|
||||
sdl_stretch(&ww, &wh, &wx, &wy);
|
||||
|
||||
MoveWindow(sdl_hwnd, wx, wy, ww, wh, TRUE);
|
||||
|
||||
cur_w = x;
|
||||
cur_h = y;
|
||||
}
|
||||
62
src/win/win_sdl.h
Normal file
62
src/win/win_sdl.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Definitions for the libSDL2 rendering module.
|
||||
*
|
||||
* Version: @(#)win_sdl.h 1.0.0 2018/05/26
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Michael Dr<44>ing, <michael@drueing.de>
|
||||
*
|
||||
* Copyright 2018 Fred N. van Kempen.
|
||||
* Copyright 2018 Michael Dr<44>ing.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the entire
|
||||
* above notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names
|
||||
* of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef WIN_SDL_H
|
||||
# define WIN_SDL_H
|
||||
|
||||
|
||||
extern void sdl_close(void);
|
||||
extern int sdl_init(HWND h);
|
||||
extern int sdl_init_fs(HWND h);
|
||||
extern int sdl_pause(void);
|
||||
extern void sdl_resize(int x, int y);
|
||||
|
||||
extern void sdl_take_screenshot(const wchar_t *fn);
|
||||
|
||||
|
||||
#endif /*WIN_SDL_H*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Implement the application's Status Bar.
|
||||
*
|
||||
* Version: @(#)win_stbar.c 1.0.17 2018/03/26
|
||||
* Version: @(#)win_stbar.c 1.0.18 2018/05/25
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
@@ -35,10 +35,10 @@
|
||||
#include "../machine/machine.h"
|
||||
#include "../disk/hdd.h"
|
||||
#include "../disk/hdc.h"
|
||||
#include "../disk/zip.h"
|
||||
#include "../floppy/fdd.h"
|
||||
#include "../scsi/scsi.h"
|
||||
#include "../cdrom/cdrom.h"
|
||||
#include "../disk/zip.h"
|
||||
#include "../cdrom/cdrom_image.h"
|
||||
#include "../cdrom/cdrom_null.h"
|
||||
#include "../scsi/scsi_disk.h"
|
||||
@@ -64,7 +64,7 @@ static HMENU menuSBAR;
|
||||
static WCHAR **sbTips;
|
||||
static int *iStatusWidths;
|
||||
static int *sb_part_meanings;
|
||||
static int *sb_part_icons;
|
||||
static uint8_t *sb_part_icons;
|
||||
static int sb_parts = 0;
|
||||
static int sb_ready = 0;
|
||||
static uint8_t sb_map[256];
|
||||
@@ -74,7 +74,7 @@ static uint8_t sb_map[256];
|
||||
intptr_t
|
||||
fdd_type_to_icon(int type)
|
||||
{
|
||||
int ret = 512;
|
||||
int ret = 248;
|
||||
|
||||
switch(type) {
|
||||
case 0:
|
||||
@@ -82,12 +82,12 @@ fdd_type_to_icon(int type)
|
||||
|
||||
case 1: case 2: case 3: case 4:
|
||||
case 5: case 6:
|
||||
ret = 128;
|
||||
ret = 16;
|
||||
break;
|
||||
|
||||
case 7: case 8: case 9: case 10:
|
||||
case 11: case 12: case 13:
|
||||
ret = 144;
|
||||
ret = 24;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -118,18 +118,18 @@ static void
|
||||
StatusBarCreateFloppySubmenu(HMENU m, int id)
|
||||
{
|
||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_NEW | id,
|
||||
plat_get_string(IDS_2161));
|
||||
plat_get_string(IDS_2096));
|
||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING | id,
|
||||
plat_get_string(IDS_2162));
|
||||
plat_get_string(IDS_2097));
|
||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING_WP | id,
|
||||
plat_get_string(IDS_2163));
|
||||
plat_get_string(IDS_2098));
|
||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_EXPORT_TO_86F | id,
|
||||
plat_get_string(IDS_2172));
|
||||
plat_get_string(IDS_2080));
|
||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_EJECT | id,
|
||||
plat_get_string(IDS_2164));
|
||||
plat_get_string(IDS_2093));
|
||||
|
||||
if (floppyfns[id][0] == 0x0000) {
|
||||
EnableMenuItem(m, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
|
||||
@@ -142,15 +142,15 @@ static void
|
||||
StatusBarCreateCdromSubmenu(HMENU m, int id)
|
||||
{
|
||||
AppendMenu(m, MF_STRING, IDM_CDROM_MUTE | id,
|
||||
plat_get_string(IDS_2165));
|
||||
plat_get_string(IDS_2092));
|
||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||
AppendMenu(m, MF_STRING, IDM_CDROM_EMPTY | id,
|
||||
plat_get_string(IDS_2166));
|
||||
plat_get_string(IDS_2091));
|
||||
AppendMenu(m, MF_STRING, IDM_CDROM_RELOAD | id,
|
||||
plat_get_string(IDS_2167));
|
||||
plat_get_string(IDS_2090));
|
||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||
AppendMenu(m, MF_STRING, IDM_CDROM_IMAGE | id,
|
||||
plat_get_string(IDS_2168));
|
||||
plat_get_string(IDS_2089));
|
||||
|
||||
if (! cdrom_drives[id].sound_on)
|
||||
CheckMenuItem(m, IDM_CDROM_MUTE | id, MF_CHECKED);
|
||||
@@ -168,17 +168,17 @@ static void
|
||||
StatusBarCreateZIPSubmenu(HMENU m, int id)
|
||||
{
|
||||
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_NEW | id,
|
||||
plat_get_string(IDS_2161));
|
||||
plat_get_string(IDS_2096));
|
||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_EXISTING | id,
|
||||
plat_get_string(IDS_2162));
|
||||
plat_get_string(IDS_2097));
|
||||
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_EXISTING_WP | id,
|
||||
plat_get_string(IDS_2163));
|
||||
plat_get_string(IDS_2098));
|
||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
||||
AppendMenu(m, MF_STRING, IDM_ZIP_EJECT | id,
|
||||
plat_get_string(IDS_2164));
|
||||
plat_get_string(IDS_2093));
|
||||
AppendMenu(m, MF_STRING, IDM_ZIP_RELOAD | id,
|
||||
plat_get_string(IDS_2167));
|
||||
plat_get_string(IDS_2090));
|
||||
|
||||
if (zip_drives[id].image_path[0] == 0x0000) {
|
||||
EnableMenuItem(m, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
|
||||
@@ -206,7 +206,7 @@ ui_sb_update_icon(int tag, int active)
|
||||
found = sb_map[tag];
|
||||
if (found != 0xff) {
|
||||
sb_part_icons[found] &= ~1;
|
||||
sb_part_icons[found] |= active;
|
||||
sb_part_icons[found] |= (uint8_t) active;
|
||||
|
||||
SendMessage(hwndSBAR, SB_SETICON, found,
|
||||
(LPARAM)hIcon[sb_part_icons[found]]);
|
||||
@@ -225,8 +225,8 @@ ui_sb_update_icon_state(int tag, int state)
|
||||
|
||||
found = sb_map[tag];
|
||||
if (found != 0xff) {
|
||||
sb_part_icons[found] &= ~256;
|
||||
sb_part_icons[found] |= (state ? 256 : 0);
|
||||
sb_part_icons[found] &= ~128;
|
||||
sb_part_icons[found] |= (state ? 128 : 0);
|
||||
|
||||
SendMessage(hwndSBAR, SB_SETICON, found,
|
||||
(LPARAM)hIcon[sb_part_icons[found]]);
|
||||
@@ -245,10 +245,10 @@ StatusBarCreateFloppyTip(int part)
|
||||
mbstowcs(wtext, fdd_getname(fdd_get_type(drive)),
|
||||
strlen(fdd_getname(fdd_get_type(drive))) + 1);
|
||||
if (wcslen(floppyfns[drive]) == 0) {
|
||||
_swprintf(tempTip, plat_get_string(IDS_2158),
|
||||
_swprintf(tempTip, plat_get_string(IDS_2117),
|
||||
drive+1, wtext, plat_get_string(IDS_2057));
|
||||
} else {
|
||||
_swprintf(tempTip, plat_get_string(IDS_2158),
|
||||
_swprintf(tempTip, plat_get_string(IDS_2117),
|
||||
drive+1, wtext, floppyfns[drive]);
|
||||
}
|
||||
|
||||
@@ -305,10 +305,10 @@ StatusBarCreateZIPTip(int part)
|
||||
int type = zip_drives[drive].is_250 ? 250 : 100;
|
||||
|
||||
if (wcslen(zip_drives[drive].image_path) == 0) {
|
||||
_swprintf(tempTip, plat_get_string(IDS_2177),
|
||||
_swprintf(tempTip, plat_get_string(IDS_2054),
|
||||
type, drive+1, szText, plat_get_string(IDS_2057));
|
||||
} else {
|
||||
_swprintf(tempTip, plat_get_string(IDS_2177),
|
||||
_swprintf(tempTip, plat_get_string(IDS_2054),
|
||||
type, drive+1, szText, zip_drives[drive].image_path);
|
||||
}
|
||||
|
||||
@@ -561,8 +561,8 @@ ui_sb_update_panes(void)
|
||||
memset(iStatusWidths, 0, sb_parts * sizeof(int));
|
||||
sb_part_meanings = (int *)malloc(sb_parts * sizeof(int));
|
||||
memset(sb_part_meanings, 0, sb_parts * sizeof(int));
|
||||
sb_part_icons = (int *)malloc(sb_parts * sizeof(int));
|
||||
memset(sb_part_icons, 0, sb_parts * sizeof(int));
|
||||
sb_part_icons = (uint8_t *)malloc(sb_parts * sizeof(uint8_t));
|
||||
memset(sb_part_icons, 0, sb_parts * sizeof(uint8_t));
|
||||
sb_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU));
|
||||
memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU));
|
||||
sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *));
|
||||
@@ -670,21 +670,21 @@ ui_sb_update_panes(void)
|
||||
for (i=0; i<sb_parts; i++) {
|
||||
switch (sb_part_meanings[i] & 0xf0) {
|
||||
case SB_FLOPPY: /* Floppy */
|
||||
sb_part_icons[i] = (wcslen(floppyfns[sb_part_meanings[i] & 0xf]) == 0) ? 256 : 0;
|
||||
sb_part_icons[i] = (wcslen(floppyfns[sb_part_meanings[i] & 0xf]) == 0) ? 128 : 0;
|
||||
sb_part_icons[i] |= fdd_type_to_icon(fdd_get_type(sb_part_meanings[i] & 0xf));
|
||||
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
|
||||
StatusBarCreateFloppySubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
|
||||
EnableMenuItem(sb_menu_handles[i], IDM_FLOPPY_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 256) ? MF_GRAYED : MF_ENABLED));
|
||||
EnableMenuItem(sb_menu_handles[i], IDM_FLOPPY_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 128) ? MF_GRAYED : MF_ENABLED));
|
||||
StatusBarCreateFloppyTip(i);
|
||||
break;
|
||||
|
||||
case SB_CDROM: /* CD-ROM */
|
||||
id = sb_part_meanings[i] & 0xf;
|
||||
if (cdrom_drives[id].host_drive == 200)
|
||||
sb_part_icons[i] = (wcslen(cdrom_image[id].image_path) == 0) ? 256 : 0;
|
||||
sb_part_icons[i] = (wcslen(cdrom_image[id].image_path) == 0) ? 128 : 0;
|
||||
else
|
||||
sb_part_icons[i] = 256;
|
||||
sb_part_icons[i] |= 160;
|
||||
sb_part_icons[i] = 128;
|
||||
sb_part_icons[i] |= 32;
|
||||
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
|
||||
StatusBarCreateCdromSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
|
||||
EnableMenuItem(sb_menu_handles[i], IDM_CDROM_RELOAD | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | MF_GRAYED);
|
||||
@@ -692,36 +692,36 @@ ui_sb_update_panes(void)
|
||||
break;
|
||||
|
||||
case SB_ZIP: /* Iomega ZIP */
|
||||
sb_part_icons[i] = (wcslen(zip_drives[sb_part_meanings[i] & 0xf].image_path) == 0) ? 256 : 0;
|
||||
sb_part_icons[i] |= 176;
|
||||
sb_part_icons[i] = (wcslen(zip_drives[sb_part_meanings[i] & 0xf].image_path) == 0) ? 128 : 0;
|
||||
sb_part_icons[i] |= 48;
|
||||
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
|
||||
StatusBarCreateZIPSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
|
||||
EnableMenuItem(sb_menu_handles[i], IDM_ZIP_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 256) ? MF_GRAYED : MF_ENABLED));
|
||||
EnableMenuItem(sb_menu_handles[i], IDM_ZIP_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 128) ? MF_GRAYED : MF_ENABLED));
|
||||
StatusBarCreateZIPTip(i);
|
||||
break;
|
||||
|
||||
case SB_HDD: /* Hard disk */
|
||||
sb_part_icons[i] = 192;
|
||||
sb_part_icons[i] = 64;
|
||||
StatusBarCreateDiskTip(i);
|
||||
break;
|
||||
|
||||
case SB_NETWORK: /* Network */
|
||||
sb_part_icons[i] = 208;
|
||||
sb_part_icons[i] = 80;
|
||||
StatusBarCreateNetworkTip(i);
|
||||
break;
|
||||
|
||||
case SB_SOUND: /* Sound */
|
||||
sb_part_icons[i] = 259;
|
||||
sb_part_icons[i] = 243;
|
||||
StatusBarCreateSoundTip(i);
|
||||
break;
|
||||
|
||||
case SB_TEXT: /* Status text */
|
||||
SendMessage(hwndSBAR, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM)L"");
|
||||
sb_part_icons[i] = -1;
|
||||
sb_part_icons[i] = 255;
|
||||
break;
|
||||
}
|
||||
|
||||
if (sb_part_icons[i] != -1) {
|
||||
if (sb_part_icons[i] != 255) {
|
||||
SendMessage(hwndSBAR, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM)L"");
|
||||
SendMessage(hwndSBAR, SB_SETICON, i, (LPARAM)hIcon[sb_part_icons[i]]);
|
||||
SendMessage(hwndSBAR, SB_SETTIPTEXT, i, (LPARAM)sbTips[i]);
|
||||
@@ -764,10 +764,10 @@ ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
|
||||
void
|
||||
ui_sb_mount_zip_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
|
||||
{
|
||||
zip_close(id);
|
||||
zip_disk_close(zip[id]);
|
||||
zip_drives[id].ui_writeprot = wp;
|
||||
zip_load(id, file_name);
|
||||
zip_insert(id);
|
||||
zip_load(zip[id], file_name);
|
||||
zip_insert(zip[id]);
|
||||
ui_sb_update_icon_state(SB_ZIP | id, wcslen(zip_drives[id].image_path) ? 0 : 1);
|
||||
EnableMenuItem(sb_menu_handles[part], IDM_ZIP_EJECT | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_ENABLED : MF_GRAYED));
|
||||
EnableMenuItem(sb_menu_handles[part], IDM_ZIP_RELOAD | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_GRAYED : MF_ENABLED));
|
||||
@@ -812,7 +812,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
||||
break;
|
||||
|
||||
ret = file_dlg_w_st(hwnd, IDS_2159, floppyfns[id], 0);
|
||||
ret = file_dlg_w_st(hwnd, IDS_2118, floppyfns[id], 0);
|
||||
if (! ret)
|
||||
ui_sb_mount_floppy_img(id, part, (item_id == IDM_FLOPPY_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring);
|
||||
break;
|
||||
@@ -837,7 +837,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
||||
break;
|
||||
|
||||
ret = file_dlg_w_st(hwnd, IDS_2173, floppyfns[id], 1);
|
||||
ret = file_dlg_w_st(hwnd, IDS_2076, floppyfns[id], 1);
|
||||
if (! ret) {
|
||||
plat_pause(1);
|
||||
ret = d86f_export(id, wopenfilestring);
|
||||
@@ -916,7 +916,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
||||
break;
|
||||
|
||||
ret = file_dlg_w_st(hwnd, IDS_2175, zip_drives[id].image_path, 0);
|
||||
ret = file_dlg_w_st(hwnd, IDS_2058, zip_drives[id].image_path, 0);
|
||||
if (! ret)
|
||||
ui_sb_mount_zip_img(id, part, (item_id == IDM_ZIP_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring);
|
||||
break;
|
||||
@@ -971,31 +971,31 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
||||
{
|
||||
RECT rectDialog;
|
||||
int dw, dh;
|
||||
uintptr_t i;
|
||||
uint8_t i;
|
||||
|
||||
/* Load our icons into the cache for faster access. */
|
||||
for (i = 128; i < 130; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
for (i = 16; i < 18; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 24; i < 26; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 32; i < 34; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 48; i < 50; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 64; i < 66; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 80; i < 82; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 144; i < 146; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 152; i < 154; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 160; i < 162; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 176; i < 178; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
for (i = 192; i < 194; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
for (i = 208; i < 210; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
for (i = 259; i < 260; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
for (i = 384; i < 386; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
for (i = 400; i < 402; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
for (i = 416; i < 418; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
for (i = 432; i < 434; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) i);
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
for (i = 243; i < 244; i++)
|
||||
hIcon[i] = LoadIconEx((PCTSTR) (uintptr_t) i);
|
||||
|
||||
GetWindowRect(hwndParent, &rectDialog);
|
||||
dw = rectDialog.right - rectDialog.left;
|
||||
@@ -1037,8 +1037,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
||||
memset(iStatusWidths, 0, sb_parts * sizeof(int));
|
||||
sb_part_meanings = (int *)malloc(sb_parts * sizeof(int));
|
||||
memset(sb_part_meanings, 0, sb_parts * sizeof(int));
|
||||
sb_part_icons = (int *)malloc(sb_parts * sizeof(int));
|
||||
memset(sb_part_icons, 0, sb_parts * sizeof(int));
|
||||
sb_part_icons = (uint8_t *)malloc(sb_parts * sizeof(uint8_t));
|
||||
memset(sb_part_icons, 0, sb_parts * sizeof(uint8_t));
|
||||
sb_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU));
|
||||
memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU));
|
||||
sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *));
|
||||
@@ -1046,7 +1046,7 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
||||
sb_parts = 0;
|
||||
iStatusWidths[sb_parts] = -1;
|
||||
sb_part_meanings[sb_parts] = SB_TEXT;
|
||||
sb_part_icons[sb_parts] = -1;
|
||||
sb_part_icons[sb_parts] = 255;
|
||||
sb_parts++;
|
||||
SendMessage(hwndSBAR, SB_SETPARTS, (WPARAM)sb_parts, (LPARAM)iStatusWidths);
|
||||
SendMessage(hwndSBAR, SB_SETTEXT, 0 | SBT_NOBORDERS,
|
||||
|
||||
199
src/win/win_ui.c
199
src/win/win_ui.c
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* user Interface module for WinAPI on Windows.
|
||||
*
|
||||
* Version: @(#)win_ui.c 1.0.27 2018/05/01
|
||||
* Version: @(#)win_ui.c 1.0.28 2018/05/25
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -48,7 +48,7 @@
|
||||
HWND hwndMain, /* application main window */
|
||||
hwndRender; /* machine render window */
|
||||
HMENU menuMain; /* application main menu */
|
||||
HICON hIcon[512]; /* icon data loaded from resources */
|
||||
HICON hIcon[256]; /* icon data loaded from resources */
|
||||
RECT oldclip; /* mouse rect */
|
||||
int infocus = 1;
|
||||
int rctrl_is_lalt = 0;
|
||||
@@ -59,7 +59,6 @@ WCHAR wopenfilestring[260];
|
||||
|
||||
/* Local data. */
|
||||
static wchar_t wTitle[512];
|
||||
static RAWINPUTDEVICE device;
|
||||
static HHOOK hKeyboardHook;
|
||||
static int hook_enabled = 0;
|
||||
static int save_window_pos = 0;
|
||||
@@ -149,9 +148,7 @@ ResetAllMenus(void)
|
||||
CheckMenuItem(menuMain, IDM_VID_RESIZE, MF_UNCHECKED);
|
||||
CheckMenuItem(menuMain, IDM_VID_DDRAW+0, MF_UNCHECKED);
|
||||
CheckMenuItem(menuMain, IDM_VID_DDRAW+1, MF_UNCHECKED);
|
||||
#ifdef USE_VNC
|
||||
CheckMenuItem(menuMain, IDM_VID_DDRAW+2, MF_UNCHECKED);
|
||||
#endif
|
||||
#ifdef USE_VNC
|
||||
CheckMenuItem(menuMain, IDM_VID_DDRAW+3, MF_UNCHECKED);
|
||||
#endif
|
||||
@@ -382,11 +379,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case IDM_VID_DDRAW:
|
||||
case IDM_VID_D3D:
|
||||
case IDM_VID_SDL:
|
||||
#ifdef USE_VNC
|
||||
case IDM_VID_VNC:
|
||||
#endif
|
||||
#ifdef USE_RDP
|
||||
case IDM_VID_RDP:
|
||||
#endif
|
||||
CheckMenuItem(hmenu, IDM_VID_DDRAW+vid_api, MF_UNCHECKED);
|
||||
plat_setvid(LOWORD(wParam) - IDM_VID_DDRAW);
|
||||
@@ -529,63 +524,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
svga_dump_vram();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
case IDM_CONFIG_LOAD:
|
||||
plat_pause(1);
|
||||
if (!file_dlg_st(hwnd, IDS_2160, "", 0) &&
|
||||
(ui_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051) == IDYES)) {
|
||||
pc_reload(wopenfilestring);
|
||||
ResetAllMenus();
|
||||
}
|
||||
plat_pause(0);
|
||||
break;
|
||||
|
||||
case IDM_CONFIG_SAVE:
|
||||
plat_pause(1);
|
||||
if (! file_dlg_st(hwnd, IDS_2160, "", 1)) {
|
||||
config_write(wopenfilestring);
|
||||
}
|
||||
plat_pause(0);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return(0);
|
||||
|
||||
case WM_INPUT:
|
||||
keyboard_handle(lParam, infocus);
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
infocus = 1;
|
||||
if (! hook_enabled) {
|
||||
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
|
||||
LowLevelKeyboardProc,
|
||||
GetModuleHandle(NULL),
|
||||
0);
|
||||
hook_enabled = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
infocus = 0;
|
||||
plat_mouse_capture(0);
|
||||
if (hook_enabled) {
|
||||
UnhookWindowsHookEx(hKeyboardHook);
|
||||
hook_enabled = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
if (! video_fullscreen)
|
||||
plat_mouse_capture(1);
|
||||
break;
|
||||
|
||||
case WM_MBUTTONUP:
|
||||
if (mouse_get_buttons() < 3)
|
||||
plat_mouse_capture(0);
|
||||
break;
|
||||
|
||||
case WM_ENTERMENULOOP:
|
||||
break;
|
||||
|
||||
@@ -703,6 +644,26 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
default:
|
||||
return(DefWindowProc(hwnd, message, wParam, lParam));
|
||||
|
||||
case WM_SETFOCUS:
|
||||
infocus = 1;
|
||||
if (! hook_enabled) {
|
||||
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
|
||||
LowLevelKeyboardProc,
|
||||
GetModuleHandle(NULL),
|
||||
0);
|
||||
hook_enabled = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
infocus = 0;
|
||||
plat_mouse_capture(0);
|
||||
if (hook_enabled) {
|
||||
UnhookWindowsHookEx(hKeyboardHook);
|
||||
hook_enabled = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return(0);
|
||||
@@ -721,6 +682,7 @@ ui_init(int nCmdShow)
|
||||
{
|
||||
WCHAR title[200];
|
||||
WNDCLASSEX wincl; /* buffer for main window's class */
|
||||
RAWINPUTDEVICE ridev; /* RawInput device */
|
||||
MSG messages; /* received-messages buffer */
|
||||
HWND hwnd; /* handle for our window */
|
||||
HACCEL haccel; /* handle to accelerator table */
|
||||
@@ -746,8 +708,8 @@ ui_init(int nCmdShow)
|
||||
wincl.lpfnWndProc = MainWindowProcedure;
|
||||
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
|
||||
wincl.cbSize = sizeof(WNDCLASSEX);
|
||||
wincl.hIcon = LoadIcon(hinstance, (LPCTSTR)100);
|
||||
wincl.hIconSm = LoadIcon(hinstance, (LPCTSTR)100);
|
||||
wincl.hIcon = LoadIcon(hinstance, (LPCTSTR)10);
|
||||
wincl.hIconSm = LoadIcon(hinstance, (LPCTSTR)10);
|
||||
wincl.hCursor = NULL;
|
||||
wincl.lpszMenuName = NULL;
|
||||
wincl.cbClsExtra = 0;
|
||||
@@ -800,30 +762,34 @@ ui_init(int nCmdShow)
|
||||
/* Make the window visible on the screen. */
|
||||
ShowWindow(hwnd, nCmdShow);
|
||||
|
||||
/* Load the accelerator table */
|
||||
haccel = LoadAccelerators(hinstance, ACCEL_NAME);
|
||||
if (haccel == NULL) {
|
||||
/* Initialize the RawInput (keyboard) module. */
|
||||
memset(&ridev, 0x00, sizeof(ridev));
|
||||
ridev.usUsagePage = 0x01;
|
||||
ridev.usUsage = 0x06;
|
||||
ridev.dwFlags = RIDEV_NOHOTKEYS;
|
||||
ridev.hwndTarget = NULL; /* current focus window */
|
||||
if (! RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) {
|
||||
MessageBox(hwndMain,
|
||||
plat_get_string(IDS_2153),
|
||||
plat_get_string(IDS_2050),
|
||||
MB_OK | MB_ICONERROR);
|
||||
return(3);
|
||||
}
|
||||
|
||||
/* Initialize the input (keyboard, mouse, game) module. */
|
||||
device.usUsagePage = 0x01;
|
||||
device.usUsage = 0x06;
|
||||
device.dwFlags = RIDEV_NOHOTKEYS;
|
||||
device.hwndTarget = hwnd;
|
||||
if (! RegisterRawInputDevices(&device, 1, sizeof(device))) {
|
||||
MessageBox(hwndMain,
|
||||
plat_get_string(IDS_2154),
|
||||
plat_get_string(IDS_2114),
|
||||
plat_get_string(IDS_2050),
|
||||
MB_OK | MB_ICONERROR);
|
||||
return(4);
|
||||
}
|
||||
keyboard_getkeymap();
|
||||
|
||||
/* Set up the main window for RawInput. */
|
||||
plat_set_input(hwndMain);
|
||||
|
||||
/* Load the accelerator table */
|
||||
haccel = LoadAccelerators(hinstance, ACCEL_NAME);
|
||||
if (haccel == NULL) {
|
||||
MessageBox(hwndMain,
|
||||
plat_get_string(IDS_2113),
|
||||
plat_get_string(IDS_2050),
|
||||
MB_OK | MB_ICONERROR);
|
||||
return(3);
|
||||
}
|
||||
|
||||
/* Initialize the mouse module. */
|
||||
win_mouse_init();
|
||||
|
||||
@@ -1042,3 +1008,74 @@ plat_mouse_capture(int on)
|
||||
mouse_capture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Catch WM_INPUT messages for 'current focus' window. */
|
||||
static LONG_PTR input_orig_proc;
|
||||
static HWND input_orig_hwnd = NULL;
|
||||
#ifdef __amd64__
|
||||
static LRESULT CALLBACK
|
||||
#else
|
||||
static BOOL CALLBACK
|
||||
#endif
|
||||
input_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message) {
|
||||
case WM_INPUT:
|
||||
keyboard_handle(lParam, infocus);
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
infocus = 1;
|
||||
if (! hook_enabled) {
|
||||
hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL,
|
||||
LowLevelKeyboardProc,
|
||||
GetModuleHandle(NULL),
|
||||
0);
|
||||
hook_enabled = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
infocus = 0;
|
||||
plat_mouse_capture(0);
|
||||
if (hook_enabled) {
|
||||
UnhookWindowsHookEx(hKeyboardHook);
|
||||
hook_enabled = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
if (! video_fullscreen)
|
||||
plat_mouse_capture(1);
|
||||
break;
|
||||
|
||||
case WM_MBUTTONUP:
|
||||
if (mouse_get_buttons() < 3)
|
||||
plat_mouse_capture(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(CallWindowProc((WNDPROC)input_orig_proc,
|
||||
hwnd, message, wParam, lParam));
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* Set up a handler for the 'currently active' window. */
|
||||
void
|
||||
plat_set_input(HWND h)
|
||||
{
|
||||
/* If needed, rest the old one first. */
|
||||
if (input_orig_hwnd != NULL) {
|
||||
SetWindowLongPtr(input_orig_hwnd, GWL_WNDPROC,
|
||||
(LONG_PTR)input_orig_proc);
|
||||
}
|
||||
|
||||
/* Redirect the window procedure so we can catch WM_INPUT. */
|
||||
input_orig_proc = GetWindowLongPtr(h, GWLP_WNDPROC);
|
||||
input_orig_hwnd = h;
|
||||
SetWindowLongPtr(h, GWL_WNDPROC, (LONG_PTR)&input_proc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user