summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/file
Commit message (Collapse)AuthorAgeFilesLines
* Clean up various stuff. Vas Crabb2025-07-011-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | docs: Explicitly state that installing a read/write tap returns the pass-through handler. cpu/mb86235: Using lowercas integer literal suffixes hurts readability, especially when it's 1ll (compare to 1LL, especially in a Courier-like font). video/ppu2c0x_vt.cpp: Look for the patterns. mame.lst: Expunge comments that started creeping back in. taito/taitotz.cpp: Use versions as printed on Taito's hard disk labels in descriptions. debug/win: Requiring every debugger window class to care about the console window's views is bad design. That's a clear case of unnecessary coupling. posix/posixptty.cpp: Testing for glibc does not guarantee pty.h is available. It's possible to build glibc for targets where its PTY wrapper functions are not implemented.
* file/posixpty.cpp: Actually enable the XPG-8 path. Vas Crabb2025-06-211-1/+1
|
* file/posixptty.cpp: Better handling of getting PTY path, etc. Vas Crabb2025-06-211-19/+77
| | | | | * Support Issue 8 TTY_NAME_MAX/ptsname_r and pre-standard ptsname_r. * Set termios flags directly rather than relying on BSD's cfmakeraw.
* -ui/info.cpp: Treat incorrect ROM content as a severe warning. Vas Crabb2025-06-181-1/+13
| | | | | | | | | | -file/winfile.cpp: Added note about file handle buffering. -taito/taitotz.cpp: Use algorithms rather than memcpy. New working clones ------------------ R-Shark (set 2) [twistedsymphony]
* osd/modules/file: define buffer size for openpty() (#13837) Pino Toscano2025-06-161-1/+16
| | | | | | | There is no defined size for the slave name returned by openpty(); OSes that have a PATH_MAX constant usually use that as limit. Create a custom OPENPTY_PATH_MAX constant specifically for openpty(), even in case PATH_MAX is not available: in that situation, use 8192 as buffer size, which hopefully should be "good enough".
* Various GNU/Hurd fixes (#13792) Pino Toscano2025-06-092-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bx: Small platform detection/usage improvements * Use BX_PLATFORM_POSIX where needed The semaphone implementation already uses BX_PLATFORM_POSIX to include <pthread.h> on all the POSIX platforms; do the same also in other places for consistency. This is done also for <sched.h>, which is a POSIX API, and sched_yield() from it is already guarded by BX_PLATFORM_POSIX. * Drop support for GNU libc older than 2.12 glibc 2.12 was released on 2010, and at this point any supported Linux distro has that version or way greather than that. From bkaradzic/bx@b59b7debd32260750c2af71f62585d9b438b3b96 * bx: fix <pthread/pthread.h> include on Hurd <pthread/pthread.h> does not exist, the standard <pthread.h> does exist so switch to it. * osd/modules/file: use dirent::d_type on any GNU libc platform This BSD extension is provided by GNU libc, so enable its usage with that C library. * osd/modules/file: use <pty.h> on any GNU libc platform openpty() is implemented by GNU libc for all the OSes, so include <pty.h> when using that C library. * osd/modules/file: cast dirent::d_name to const char* before using it According to POSIX [1], the type of dirent::d_name is loosely defined as "char d_name[]", as array with an undefined size. In particular, few ways are seen in the wild: (a) "char d_name[size]", i.e. as proper array with a full size (b) "char d_name[1]"/"char d_name[0]", i.e. as C flexible arrays Regardless of its type, dirent::d_name is used as if it was a classic const char *, i.e. as pointer to a null-terminated string. util::string_format() uses C++ templates to collect all the arguments, and thus it will use the actual type of dirent::d_name. In case of (a) there is no issue, however for (b) the result is that only the first character is used. To ensure that dirent::d_name is fully used, explicitly cast it to const char * before passing it to util::string_format(), so the whole string is used. [1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html
* -sound/xaudio2_sound.cpp: Changed buffering strategy for output streams. Vas Crabb2025-06-065-15/+28
| | | | | | | | | | | | | | | | | * This should work better with output devices like Bluetooth speakers, and should be a bit smoother in general. -osd/osdfile.h: Ensure size isn't passed to ::operator delete when destructing directory entries. * osd_stat allocates additional space following the directory entry to store the name. A regular delete may pass sizeof(entry) to ::operator delete, which won't match the allocated size. This causes a problem if the runtime library checks it. (May suppress the warning in MT09137.) -sound: Got rid of dependencies on emu and frontend. We're working to reduce circular dependencies. Adding more is a regression.
* -sound/wasapi_sound.cpp, sound/xaudio2_sound.cpp: Fixed device names. Vas Crabb2025-05-302-16/+30
| | | | | | | -file/winfile.cpp: Align allocation for directory entry structure in osd_stat. -file/stdfile.cpp: Updated signature for osd_stat.
* posixfile.cpp: Pass in explcit alignment to operator new just in case. Vas Crabb2025-03-051-1/+5
|
* posixfile.cpp: nothrow is passed to operator new, not to reinterpret_cast. Vas Crabb2025-03-051-1/+1
|
* bmc/bmcpokr.cpp: Improved DIP switch settings for xyddzhh. Vas Crabb2025-03-051-5/+5
|
* osd/modules/file: Don't magically substitute environment variables when ↵ npwoods2022-12-174-13/+3
| | | | | | | | 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.
* Patched up some gaps in functionality and fixed some bugs. Vas Crabb2022-09-023-84/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* osdcore.h: Changed osd_subst_env to accept a std::string_view and return a ↵ npwoods2022-06-154-7/+7
| | | | std::string. (#9928)
* Revert "bitbanger: Add udp multicast support (#9744)" (#9749) Vas Crabb2022-05-136-329/+19
| | | This reverts commit 5052eb307a959644677037be52b9a168a68775dd.
* bitbanger: Add udp multicast support (#9744) tedgreen992022-05-126-19/+329
| | | Example usage: -bitb udp.234.99.99.99:15122
* -ui: Made zoom controls a bit more intuitive. Vas Crabb2021-09-062-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * The UI controls are described as zoom in/out, but they had the opposite effect on the palette and tile viewers. That has been changed to make them consistent with the tilemap viewer. * Made the default zoom key not act as a toggle. People are familiar with the function of Ctrl+0/=/- in web browsers, so making them behave similarly in MAME should make it more approachable. Also added the default zoom key to the relevant documentation page. * Implemented the default zoom key for the palette and tile viewers. * In the tilemap viewer, if the view is in default expand to fit mode, zoom in/out starting from the actual zoom ratio. Once again, this behaves more like the zoom controls in a web browser displaying an image so it should be more intuitive. * Made more messages from the tilemap viewer localisable. -util/zippath.cpp: Fixed MT08074. * There were multiple issues at play here. After #8443 was applied, is_root was simply never returning true on Windows, as OSD_WINDOWS isn't actually defined outside libosd and libocore. This caused phantom parent items to appear in disk roots on Windows, but it meant that the check in zippath_resolve would always fail so the trailing backslash would be trimmed. Fixing the macro test in is_root meant the trailing backslash from C:\ would no longer be trimmed, which caused the stat in zippath_resolve to fail. -bigbord2.cpp: Hooked up floppy DRQ that had somehow got lost. -Reduced tag map lookups in several drivers and devices. -util/coretmpl.h: Removed an overload of bitswap that can be avoided using if constexpr. -Added doxygen comments to some classes, and fixed several doxygen warnings. -util, osd: Test for _WIN32 rather than WIN32. * In C++17 mode, WIN32 is no longer a predefined macro, although various things in 3rdparty define it to maintain legacy support. We're better off moving forward anyway for when WIN32 disappears entirely. (WIN32 is not a reserved name, while _WIN32 is, starting with an underscore follwed by an uppercase letter.)
* osd: Return would block when reading a socket with no data available - no ↵ Vas Crabb2021-08-272-2/+2
| | | | error can be confused with remote shutdown.
* formats, osd, util: Started refactoring file I/O stuff. (#8456) Vas Crabb2021-08-2210-612/+501
| | | | | | | | | Added more modern generic I/O interfaces with implementation backed by stdio, osd_file and core_file, replacing io_generic. Also replaced core_file's build-in zlib compression with a filter. unzip.cpp, un7z.cpp: Added option to supply abstract I/O interface rather than filename. Converted osd_file, core_file, archive_file, chd_file and device_image_interface to use std::error_condition rather than their own error enums. Allow mounting TI-99 RPK from inside archives.
* Eliminate ARRAY_LENGTH template in favor of C++17's std::size AJR2021-02-141-1/+1
| | | | | | | | | | * 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
* Tidy up loose ends: Vas Crabb2021-01-064-23/+96
| | | | | | | | * Fixed a couple of fixed-size buffers in Windows OSD code. * Marked MAME as aware of long paths in Windows manifest. * Made a cleaner, thread-safe API for getting volume names. * Added compile-time option to disable recompiler W^X mode. * NuBus image device current directory doesn't need to be pinned.
* windir.cpp, winrtdir.cpp: string_format calls need qualification now AJR2021-01-022-2/+2
|
* Low-level #include overhaul AJR2021-01-0214-5/+14
| | | | | | | - vecstream.h: Revert changes made in aa29519528cb3dbdbfac56819bea670ed8c56c5d. The std::string_view conversion has been made a non-member function (util::buf_to_string_view) and moved to coretmpl.h. - strformat.h: Remove the using declaration importing util::string_format into the global namespace. It has been moved to emucore.h and a few tool sources; other references have been qualified. - osdcore.h: Split out file, directory and path classes and methods to a new header (osdfile.h), Doxygenizing the documentation comments. - Disaggregate many #includes that were including other standard or custom headers. emu.h now includes basically the same things that it did, but other headers have been streamlined; for instance, emucore.h no longer stealth-includes osdcore.h several ways.
* Mame: Fix compilation errors in 'posixfile.cpp', for older MacOS/Xcode releases Masc Guy2020-12-091-0/+5
|
* FreeBSD fixes (#7295) Emmanuel Vadot2020-09-271-1/+1
| | | | | | | | | | | | * psixptty: Fix for FreeBSD We need to check for __FreeBSD__ not __FreeBSD_kernel__ * FreeBSD: Use gl includes from pkg-config FreeBSD doesn't install the includes from 3rdparty software in a default location so use pkg-config to get the correct path. * FreeBSD: genieos is named simple bsd
* Merge pull request #6195 from firewave/includes R. Belmont2020-01-2211-19/+19
|\ | | | | use C++ library includes (nw)
| * use C++ library includes (nw) firewave2020-01-2211-19/+19
| |
* | fixed some clang-tidy warnings (nw) (#6197) Oliver Stöneberg2020-01-221-1/+1
|/ | | | | | | | | | | | | | * fixed some bugprone-throw-keyword-missing clang-tidy warnings (nw) * fixed some modernize-use-nullptr clang-tidy warnings (nw) * fixed some readability-delete-null-pointer clang-tidy warnings (nw) * fixed some performance-faster-string-find clang-tidy warnings (nw) * fixed some performance-for-range-copy clang-tidy warnings (nw) * fixed some readability-redundant-string-cstr clang-tidy warnings (nw)
* winptty: don't create pipe unless requested (nw) cracyc2019-11-161-1/+2
| | | | plugins/discord: disconnect if timed out (nw)
* (nw) add doxygen comments for a bunch of core stuff, and convert a bunch of ↵ Vas Crabb2019-10-161-3/+4
| | | | comments to doxygen format
* Fix Solaris 2.11 (non-Oracle) Rick V2019-08-191-1/+5
|
* Fix build in newer Emscripten versions (nw) Justin Kerk2019-08-083-5/+5
|
* Use canonical spelling of "canonical" (nw) AJR2019-08-022-2/+2
|
* Fix OS X build after a45221458dfba557ae32c0073750a06deea3f45e (nw) AJR2018-12-111-3/+1
| | | | posixptty.cpp uses openpty, which remains in <util.h> under OS X.
* Android compile fix (#4395) Miodrag Milanović2018-12-111-1/+3
| | | | | | | | | | * Fix compile for Android, set API to 24 * Update Android Studio project to API 24 * Fixed project file to latest Android Studio * fix build with gradle alone
* Discord plugin try 2 (#3640) cracyc2018-06-084-2/+223
| | | | | | | | | | | * plugins/discord: discord presence plugin [Carl] * plugins/discord: use domain sockets and pipes [Carl] * winptty: fix connecting to existing socket (nw) plugins/discord: show pause state (nw) * plugins/discord: fix pause behavior (nw)
* Set SO_REUSEADDR in posixsocket Sven Schnelle2018-04-161-0/+8
| | | | | | | | | Without it you have to wait until the socket is moved out of the TIME_WAIT state, which can take quite a while. This is pretty anoying when using mame with serial ports forwarded via TCP. Signed-off-by: Sven Schnelle <svens@stackframe.org>
* Revert "Revert "Merge branch 'master' of https://github.com/mamedev/mame"" Firehawke2017-12-132-1/+2
| | | | This reverts commit 54155441e9ba9941e85d80c4834a66376a11e791.
* Revert "Merge branch 'master' of https://github.com/mamedev/mame" Firehawke2017-12-132-2/+1
| | | | | This reverts commit f537428e5a40ba6dde8ca9bf0fe9ae6b1f189ac4, reversing changes made to 0d70d798107d4e4e8fb9f230410aeb1e888d65c5.
* fix MT06785 Vas Crabb2017-12-072-1/+2
|
* this file is Allman style, use nullptr for NULL pointers, DeviceIoControl ↵ Vas Crabb2017-11-291-6/+8
| | | | returns BOOL so treat it like a boolean (nw)
* chdman: Patch to allow chdman to access physical drives on Windows 10 Ted Green2017-11-241-1/+18
|
* Move special windows.h include directives to build defines (nw) Brad Hughes2016-12-288-8/+0
|
* A round of spelling/typographical fixes to source comments (nw) Scott Stone2016-11-242-2/+2
|
* Implemented GetFileSize and and proper winrt file open (nw) Miodrag Milanovic2016-11-121-4/+2
|
* No need for osd_malloc, osd_malloc_array and osd_free (nw) Miodrag Milanovic2016-11-112-2/+2
| | | | MALLOC_DEBUG not applicable anymore since we use new to allocate in 99.9% of cases
* Some more work on UWP (nw) Miodrag Milanovic2016-11-105-0/+1002
|
* Prevent -Wexpansion-to-defined warning in recent Clang (nw) Justin Kerk2016-10-281-1/+5
|
* final cleanup of TRUE/FALSE, left only in windows section where it represent ↵ Miodrag Milanovic2016-10-223-10/+10
| | | | BOOL (nw)
* Cleanup linux OSD (nw) Miodrag Milanovic2016-10-221-1/+1
|