Commit Graph

1006 Commits

Author SHA1 Message Date
Vas Crabb
11ad85f0a4 osd/windows, osd/sdl: Only check for hold/drag conversion on losing pointer if it hasn't already happened. 2024-11-18 05:07:27 +11:00
Vas Crabb
80d04627a6 -util/corefile.cpp: Fixed core_file failing to propagate write errors.
-util/ioprocs.cpp: Reverted gross hack.

-osd/windows: Ensure WM_MOUSE* to WM_POINTER* event translation is always disabled.

-tecmo/gaiden.cpp: Call base device_post_load(), use logmacro.h.
2024-06-21 07:16:45 +10:00
Vas Crabb
2c96db827d ui/selmenu.cpp: Fixed issue with focus rotation when filter matches no items. 2024-05-11 04:41:48 +10:00
Vas Crabb
e22aae63a1 -merit/mtouchxl.cpp: Added touch-enabled layout.
-ui/tapectrl.cpp: Ensure device monitored for media change is up-to-date.

-osd/windows: Changed a pointer to a const reference in an API.
2024-05-09 04:43:56 +10:00
Vas Crabb
64834145ae -osd: Update slider list on demand rather than on frame updated (fixes MT08857).
-konami/konamigq.cpp: No need to cancel a newly allocated timer.
2024-04-27 04:42:12 +10:00
Vas Crabb
f91b896cda input/input_sdl.cpp: Added an SDL lightgun provider.
This does essentially the same thing as the Win32 lightgun provider,
mapping the absolute pointer position over the window to gun axes.

Also added a bunch of const in the windows input handling code.

docs: Bumped version, as features that are not in a releaesd version of
MAME are now documented.
2024-04-26 06:26:22 +10:00
Vas Crabb
4ddd26fe21 Initial touch input support:
* Feed mouse/pen/touch pointer events through UI input manager with Win32 and SDL.
* Started migrating UI code to use new API and reworking mouse/touch interaction.
* emu/render.cpp: Support pressing multiple clickable layout items simultaneously.
* emu/render.cpp: Allow UI elements to be drawn in any window.
* emu/rendlay.cpp, luaengine_render.cpp: Added layout view events for pointer input.
* ui/ui.cpp: Allow the UI handler to control pointer display.
* ui/analogipt.cpp: Added mouse/touch and more keys for navigating field state list.
* ui/menu.cpp: Use vertical swipe to scroll and horizontal swipe to adjust.
* ui/menu.cpp: Draw after processing input - greatly improves responsiveness.
* ui/menu.cpp: Ignore keyboard/gamepad input during pointer actions.
* ui/selmenu.cpp: Made left/right info pane arrows repeat when held.
* ui/selmenu.cpp: Use middle click to move keyboard focus.
* ui/selmenu.cpp: Let filter list scroll if it's too tall, and use a bit of horizontal padding.
* ui/selmenu.cpp: Improved divider sizing.
* ui/state.cpp: Don't allow clicks to pass through the confirm deletion prompt to the menu.
* ui/simpleselgame.cpp: Fixed error message display and graphics/sound status not showing.
* ui/simpleselgame.cpp: Allow tap/click to dismiss error message.
* ui/utils.cpp: Show UI for choice filters when there are no choices - it's less confusing.
* modules/input/input_sdl.cpp: Made scaling for mouse scroll better match RawInput and DirectInput.
* modules/input/input_rawinput.cpp: Added support for horizontal scroll axis.
* modules/input/input_win32.cpp: Added support for scroll axes and more buttons to mouse/lightgun.
* modules/debugger/debugimgui.cpp: Don't fight over events with the UI manager - it breaks menus.
* osd/windows/window.cpp: Translate mouse position to window cooridinates for scroll wheel events.
* osd/sdl/window.cpp: Supply last mouse position for scroll wheel events if possible.
* scripts/build/complay.py: Made zero input mask an error - it was only being used to block clicks.
2024-04-12 02:49:15 +10:00
Vas Crabb
2931abbcf4 osd/modules/input: Various cleanup and minor enhancements.
input_common.h: Got rid of the DirectInput key code macros.  DirectInput
headers are always available on Windows - it's just an opportunity for
bygs.

input_common.cpp: Added default names for keys mapped to MAME's "other
switch" type.

input_rawinput.cpp: Simulate Pause key being held for 30ms, similarly to
what's done for Caps Lock on macOS with SDL.  Also added a gross hack to
give "correct" names for Pause and Num Lock.

input_sdl.cpp: Get default key names from SDL.  Not really that useful
as it isn't aware of the current keyboard layout.  Key map files are
still needed for anything other than a US ANSI layout.

Also added some comments.
2024-03-04 07:05:28 +11:00
MooglyGuy
dd1a4eb431
Skeleton driver for 600 Cellular Activation Tester (#11225)
* New systems marked not working
------------------------------
600 Cellular Activation Tester [Ryan Holtz, Leo Romo]

-m6801.cpp: Fixed HD6303R to use an internal map, removed internal-only
handlers from associated drivers. [Ryan Holtz]

-video.cpp: Raised maximum prescale value to 20 to account for very
small LCDs. [Ryan Holtz]

-screen.cpp: Replaced old MCFG_ references in a warning message with
member function names. [Ryan Holtz]

* -timekpr: Added Dallas DS1643, a clone of the STMicro M48T58. [Ryan Holtz]
2023-05-13 17:12:17 -04:00
Vas Crabb
4a18756e4f osd/windows: Create single-threaded COM apartment on main thread. 2023-04-08 06:17:30 +10:00
Vas Crabb
4cf33cfe0a Various optimisations to code generaton.
util/bitmap.cpp, util/palette.cpp: Marked lots of things constexpr.
Bitmaps don't throw exceptions on allocation failure, they just become
invalid.  Almost nothing in MAME actually checks for this.

emu/profiler.cpp: Abort if the profile stack overflows rather than
throwing an exception.  This is a developer feature and if it overflows,
the code is broken.  Calling a noreturn noexcept function generates less
code than throwing an exception, which adds up.

util/strformat.cpp: Traded away some unnecessary flexibility for more
compact code.  The stream objects must derive from std::basic_ostream
now - they can't just be any old objects with the expected operators.
2023-03-26 01:32:50 +11:00
Vas Crabb
a4e8ffe3dc osd: Moved some windows-specific stuff into osd/windows/window.{h,cpp}. 2023-02-26 03:18:36 +11:00
Vas Crabb
65aeb63a2a Update accumulating relative inputs exactly once per frame.
This fixes "amplification" effects that would happen if the frame rate
rose above 100 Hz (whether by unthrottling or otherwise).

Synchronise with wall clock any time inputs are read.  Not doing this
has weird effects on relative inputs with frame skipping and contributes
to unresponsiveness of menus.

Reduce visual latency for mouse movement on menus when paused or
skipping frames.  The rest of the code changes to menus won't provide
benefits until draw can happen after event handling.
2023-02-24 19:31:12 +11:00
Vas Crabb
98131a6b9e osd: Cleaner way of dealing with input updates. 2023-02-23 06:33:22 +11:00
Vas Crabb
a72c02133f osd: Don't pump events when reading inputs.
This was a drain on performance.  If anything is trying to poll inputs
in a loop, it needs to call input_update() to ensure it gets up-to-date
state.
2023-02-23 02:06:28 +11:00
Vas Crabb
6f93428f96 -osd/windows/winutil.cpp: Better way to get module handle.
* This was leftover support for Windows 2000 and earlier that hadn't
  been cleaned up.

-atari: Don't forget your #include guards!
2023-02-12 05:09:14 +11:00
Vas Crabb
3a7971b93f osd/windows/window.cpp: Allow BGFX to bounce cleanly when toggling fullscreen on Windows with multiple output screens/windows. 2023-02-02 03:41:15 +11:00
Vas Crabb
2810c9d91b osd: Turned video modules into actual modules, fixed various issues.
Don't ignore the return status of OSD module initialisation.  Attempt to
fall back to an alternate module if the selected module fails to
initialise.  Log more useful diagnostic information at verbose level.

Fixed BGFX crash on exit after toggling fullscreen.  Also persist more
settings than just the selected chains across toggling fullscreen.

Turned video modules into OSD modules in the same sense as all the other
OSD modules.  They now use the same selection/fallback mechanism as all
the other modules without special extra code in the OSD implementations.

Untangled some object ownership mess.  Windows own renderers, OSD
objects own windows.  Fixed a refrence loop that caused the first window
object to always leak.

Don't create renderer object until after underlying window has been
created.  Fixed issues with order of creation/destruction when toggling
fullscreen or changing prescale in fullscreen with -switchres in SDL
builds.

Use more smart pointers in BGFX and Direct3D render modules.  Most of
the code now reutrns a smart pointer when handing over ownership or a
naked pointer when retaining ownership.  Fixed a few leaks and
simplified cleanup code.

Encapsulated various OSD modules better.
2023-02-01 04:00:44 +11:00
Vas Crabb
68472d3d72 Various input and OSD refactoring:
osd: Supply OSD object to modules on initialisation.  Encapsulated some
event handling in the OSD objects rather than leaving it in free
functions.  Put various stuff in namespaces.

osd/modules/input: Enabled dinput, xinput and winhybrid modules for
Windows SDL builds, and enabled background input for dinput and xinput
(and by extension winhybrid) modules.  Also fixed some COM and X11
resource leaks.

osd/modules/input/input_sdl.cpp: Flipped SDL mouse button order to match
Windows, and exposed vertical and horizontal scroll as Z and rZ axes.
Moved SDL UI event handling out of input devices into OSD object.

osd/modules/input_rawinput.cpp: Changed lightgun Z axis token so it's
correctly identified as a relative axis (it maps to the scroll wheel
equivalent).

osd: Added an option to choose the network provider module.  Mostly
useful if you build with both TUN/TAP and pcap support included, or if
you want to disable emulated networking completely.

emu/input.cpp: Use a better strategy for assembling input code names
that uses fewer temporary strings and doesn't require use of the
non-Unicode-aware space trimming function (fixes MT08552).

osd/modules/input_dinput.cpp: Improved polling logic.

osd: Made various parts of the input code less dependent on concrete emu
objects, and reduced inappropriately passing around the machine object.
Made input modules less dependent on OSD implementation.  Encapsulated
some stuff and got rid of some vestigial newui and SDL1 support code.
Cleaned up some interfaces.  Moved OSD options classes to their own
files.

Prepare to remove main.h from emu.h - it's mostly used to get the
application name, which the vast majority of emulated devices don't need
to do.
2023-01-29 03:16:14 +11:00
Vas Crabb
2592ac32c1 osd: Added option to accept SDL game controller/joystick input when losing UI focus. 2023-01-14 15:57:22 +11:00
Vas Crabb
c4f62ccb59 bgfx: Save values of most sliders per-system. 2023-01-08 05:06:50 +11:00
Vas Crabb
d6fe526b28 util/options.cpp: Fixed overriden default option values from OSD. 2022-12-19 00:46:53 +11:00
npwoods
13910382a5
osd/modules/file: Don't magically substitute environment variables when opening files. (#9859)
* util/options.cpp: Added option types for single and multiple paths.
* util/options.cpp: Substitute environment variables in values from defaults and INI files.
* ui/dirmenu.cpp: Removed hard-coded list of multi-path options.
* plugins: Don't substitute environment variables in path options.
2022-12-17 06:03:59 +11:00
MooglyGuy
13aa80cb00
osd/windows/window.cpp: Fixed a crash when toggling fullscreen. [Ryan Holtz] (#10692)
osd/windows/window.cpp: Check for a non-null renderer before issuing a draw request to the renderer. [Ryan Holtz]
2022-12-16 15:23:47 +01:00
Vas Crabb
051c380fd1 Patched up some gaps in functionality and fixed some bugs.
ui: Added some missing functionality:
* Added an option to copy input device IDs to the relevant menus.
* Added an item for setting the software lists files path (-hashpath) to
  the folder setup menu.
* Allow pasting text from clipboard in most places that allow typing
  (searching, entering filenames, entering barcodes).
* Changed the software selection menu heading to be a bit less
  misleading.
* Made barcode menu less eager to rebuild itself unnecessarily, and
  removed some confusing and apparently pointless code.

Exposed more Lua bindings:
* Added low-level palette objects.
* Added indexed bitmap types.
* Added a bitmap method for extracting pixels from a rectangular area as a
  packed binary string.
* Changed screen device pixels method to return width and height in
  addition to the pixels.

osd: Added some functionality and cleaned up a little:
* Added a function for copying text to the clipboard.
* Moved function for converting Windows error codes to standard error
  conditions to winutil.cpp so it can be used from more places.
* Removed duplicate declaration of osd_get_clipboard_text and made the
  function noexcept (including fixing implementations).
* Made macOS implementation of osd_get_clipboard_text skip the encoding
  conversion if it finds UTF-8 text first.
* Changed the default -uimodekey setting so it doesn't lose the "not
  shift" that stops the default from interfering with UI paste.

Various bug fixes:
* util/unicode.cpp: Fixed the version of utf8_from_uchar that returns
  std::string blowing up on invalid codepoints.
* util/bitmap.h: Fixed wrapping constructors for indexed bitmaps taking
  the wrong parameter type (nothing was using them before).
* util/bitmap.cpp: Fixed potential use-after-free issues with bitmap
  palettes.
* emu/input.cpp, emu/inputdev.cpp: Log 1-based device numbers, matching
  what's shown in the internal UI and used in tokens in CFG files.
* emu/emumem.cpp: Added the bank tag to a fatal error message where it
  was missing.

docs: Reworked and expanded documentation on configuring stable
controller IDs.

For translators, the changes are quite minor:
* There's a menu item for copying a device ID to the clipboard, and
  associated success/failure messages.
* There's the menu item for setting the software list file search path.
* One of the lines in the software selection menu heading has changes as
  it could be interpreted as implying it showed a software list name.
2022-09-02 08:55:16 +10:00
ajrhacker
0d22ff1a9b
Clean up #includes in src/osd (#10029)
* Clean up #includes in src/osd

* render/bgfx/view.cpp: Add license header
2022-07-04 20:46:05 -04:00
npwoods
699630ed16
osdcore.h: Changed osd_subst_env to accept a std::string_view and return a std::string. (#9928) 2022-06-15 20:57:23 +10:00
npwoods
260f906804
util/options.h: Removed legacy OPTION_* option type constants. (#9851)
These constants were polluting the global namespace.
2022-05-30 02:47:53 +10:00
Vas Crabb
9ce44fa048 osd: Cleaned up Windows API usage a little.
* Bumped target windows version to 6.0.0 (Vista).
* Use WRL COM pointers to manage some COM-like objects.
* Cleaned up logging in DirectSound module.
* Cleaned up includes in Windows input modules.
* Switched to Common Item Dialogs in Windows debugger.
* Replaced disabled code that never really worked with a TODO comment.
2022-05-26 03:07:28 +10:00
hap
d3829a0932 sdl/window: add error retval check for bgfx on fallback 2022-03-25 19:08:37 +01:00
MooglyGuy
92ece92fed
Updated BGFX fixes; verified as working on Linux and Windows. (#9420)
* -bgfx: Improved stability when encountering missing files, and improved multi-window stability. [Ryan Holtz]
* -osd: Added video-init fallback functionality to other OSDs. [Ryan Holtz]
* -bgfx: Fixed issues from the previous batch of changes. [Ryan Holtz]
* -osdwindow: Remove no-longer-needed addition of post_create(). [Ryan Holtz]
2022-03-15 22:32:33 -04:00
Vas Crabb
0e457ec6ea Revert "More BGFX stability improvements (missing files + multi-window) (#9410)"
This reverts commit f5b75b7439.
2022-03-16 04:46:13 +11:00
MooglyGuy
f5b75b7439
More BGFX stability improvements (missing files + multi-window) (#9410)
* -bgfx: Improved stability when encountering missing files, and improved multi-window stability. [Ryan Holtz]

* -osd: Added video-init fallback functionality to other OSDs. [Ryan Holtz]
2022-03-14 09:32:59 -04:00
MooglyGuy
1ad39cb5dd
-bgfx: Added default LUT PNG, fixes LUT-effect crash. Fixed external texture loading, restoring HQx filters. [Ryan Holtz] (#9401) 2022-03-12 20:30:02 -05:00
Vas Crabb
a0732c3216 osd/modules/input/input_rawinput.cpp: Allow re-plugging mouse/keyboard. 2022-03-11 04:12:44 +11:00
antonioginer
5c5828d826
Correctly adjust window size based on the computed visible area for different stretching cases. (#9140) 2022-01-21 22:25:47 -05:00
antonioginer
7a6749ab86
emu/render.cpp: Improved scale factor selection. (#8961)
Fixes aspect related issues, undesired overscan, etc. (GitHub #8209, GitHub #8387, MT08110)
2022-01-06 05:26:54 +11:00
smf-
5926a2e760 clang fixes 2021-11-19 07:55:50 +00:00
Vas Crabb
d5848b215b osd/windows: Don't set parent window for error message box - it doesn't appreciate the parent being pulled out from under it. 2021-11-13 07:19:07 +11:00
Vas Crabb
839192e769 -osd/windows: Fixed stupid potential deadlock on exit.
-frontend: Some changes to menu item class that will make it possbile to
 reduce the number of menu rebuilds.
2021-11-13 02:49:51 +11:00
Vas Crabb
5c8e06be77 -osd/windows: Show error message box on a separate thread (see MT08118).
-emu/emuopts.cpp: Default to built-in UI language rather than English.
* The external English message catalog is a placeholder anyway.

-cpu/mcs48: Corrected comments - D87xxH have UVEPROM, not EEPROM.
2021-11-12 18:38:18 +11:00
Vas Crabb
1cc8bcc68e -frontend: Don't inappropriately truncate text in menu text boxes.
-osd/windows: Handle WM_UNICHAR.
2021-11-08 23:44:08 +11:00
Miodrag Milanovic
8aa5c5a29c Remove OSD_UWP from rest of code 2021-10-26 11:45:04 +02:00
Vas Crabb
ac9ca1d020 -ui: Put software description on the left and sort by description by default.
-osd/windows: Set locale on start so sorting in the UI works properly.
2021-10-06 07:14:18 +11:00
AJR
89ffebc976 Fix various typos in comments 2021-10-05 11:30:33 -04:00
antonioginer
5186eaaff1
Correctly apply -keepaspect with -unevenstretchx/y. (#8209)
* Correctly apply -keepaspect with -unevenstretchx/y. Initialize window at the correct size when -intscalex/y is used.
* Get correct window size upon maximizing/minimizing with integer scaling.
2021-07-02 20:07:21 +10:00
arbee
6704819c1f Add -share_directory option. This sets a directory on the host system which emulated systems can directly access. [R. Belmont] 2021-05-08 16:13:43 -04:00
Aaron Giles
e16d3e98d9 Disable sleep when using -bench. 2021-03-31 17:08:28 -07:00
Vas Crabb
4cf96da22c -A few incremental UI code improvements:
* Simplified message when toggling UI controls.
* Show actual configured UI toggle key, not misleading hard-coded text.
* Push window activated/deactivated events to UI manager.
* Simplified SDL window event handling code - events are pretty precise.

-Miscellaneous code cleanup.
2021-03-12 01:15:08 +11:00
AJR
bc0146c203 Eliminate ARRAY_LENGTH template in favor of C++17's std::size
* osdcomm.h: Move definition of EQUIVALENT_ARRAY to coretmpl.h

* sharc.cpp, gt64xxx.cpp, ym2413.cpp, gb_lcd.cpp, snes_ppu.cpp: Use STRUCT_MEMBER for save state registration

* gio/newport.cpp, megadrive/svp.cpp, nes_ctrl/bcbattle.cpp, arm7.cpp, tms9995.cpp, pckeybrd.cpp, sa1110.cpp, sa1111.cpp, jangou_blitter.cpp, vic4567.cpp: Use std::fill(_n) instead of memset

* emucore.h: Remove obsolete typedef
2021-02-14 11:05:57 -05:00