diff options
author | 2021-09-06 06:34:42 +1000 | |
---|---|---|
committer | 2021-09-06 06:34:42 +1000 | |
commit | 4f495994c41cd2fbaf89c08f755e828ae3261828 (patch) | |
tree | 8ea2c8522b807e394ea942460687b66e3ec7e381 /src/osd/modules/file | |
parent | 5e02ff231e2472e7e75a97b6e8758a070b227f8e (diff) |
-ui: Made zoom controls a bit more intuitive.
* 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.)
Diffstat (limited to 'src/osd/modules/file')
-rw-r--r-- | src/osd/modules/file/posixdir.cpp | 6 | ||||
-rw-r--r-- | src/osd/modules/file/posixfile.cpp | 34 |
2 files changed, 20 insertions, 20 deletions
diff --git a/src/osd/modules/file/posixdir.cpp b/src/osd/modules/file/posixdir.cpp index 9cd29a84600..63a02925bf1 100644 --- a/src/osd/modules/file/posixdir.cpp +++ b/src/osd/modules/file/posixdir.cpp @@ -22,7 +22,7 @@ #endif #endif -#ifdef WIN32 +#ifdef _WIN32 #define _FILE_OFFSET_BITS 64 #endif @@ -63,13 +63,13 @@ namespace { // CONSTANTS //============================================================ -#if defined(WIN32) +#if defined(_WIN32) constexpr char PATHSEPCH = '\\'; #else constexpr char PATHSEPCH = '/'; #endif -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__EMSCRIPTEN__) || defined(__ANDROID__) || defined(WIN32) || defined(SDLMAME_NO64BITIO) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__EMSCRIPTEN__) || defined(__ANDROID__) || defined(_WIN32) || defined(SDLMAME_NO64BITIO) using sdl_dirent = struct dirent; using sdl_stat = struct stat; #define sdl_readdir readdir diff --git a/src/osd/modules/file/posixfile.cpp b/src/osd/modules/file/posixfile.cpp index b7c1cde7442..580288c7d10 100644 --- a/src/osd/modules/file/posixfile.cpp +++ b/src/osd/modules/file/posixfile.cpp @@ -22,7 +22,7 @@ #endif #endif -#ifdef WIN32 +#ifdef _WIN32 #define _FILE_OFFSET_BITS 64 #endif @@ -69,7 +69,7 @@ namespace { // CONSTANTS //============================================================ -#if defined(WIN32) +#if defined(_WIN32) constexpr char PATHSEPCH = '\\'; constexpr char INVPATHSEPCH = '/'; #else @@ -102,7 +102,7 @@ public: #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__EMSCRIPTEN__) || defined(__ANDROID__) result = ::pread(m_fd, buffer, size_t(count), off_t(std::make_unsigned_t<off_t>(offset))); -#elif defined(WIN32) || defined(SDLMAME_NO64BITIO) +#elif defined(_WIN32) || defined(SDLMAME_NO64BITIO) if (lseek(m_fd, off_t(std::make_unsigned_t<off_t>(offset)), SEEK_SET) < 0) return std::error_condition(errno, std::generic_category()); result = ::read(m_fd, buffer, size_t(count)); @@ -123,7 +123,7 @@ public: #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__EMSCRIPTEN__) || defined(__ANDROID__) result = ::pwrite(m_fd, buffer, size_t(count), off_t(std::make_unsigned_t<off_t>(offset))); -#elif defined(WIN32) || defined(SDLMAME_NO64BITIO) +#elif defined(_WIN32) || defined(SDLMAME_NO64BITIO) if (lseek(m_fd, off_t(std::make_unsigned_t<off_t>(offset)), SEEK_SET) < 0) return std::error_condition(errno, std::generic_category()); result = ::write(m_fd, buffer, size_t(count)); @@ -142,7 +142,7 @@ public: { int result; -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__EMSCRIPTEN__) || defined(WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__EMSCRIPTEN__) || defined(_WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__) result = ::ftruncate(m_fd, off_t(std::make_unsigned_t<off_t>(offset))); #else result = ::ftruncate64(m_fd, off64_t(offset)); @@ -171,7 +171,7 @@ private: bool is_path_separator(char c) noexcept { -#if defined(WIN32) +#if defined(_WIN32) return (c == PATHSEPCH) || (c == INVPATHSEPCH); #else return c == PATHSEPCH; @@ -205,7 +205,7 @@ std::error_condition create_path_recursive(std::string_view path) noexcept return std::error_condition(); // create the path -#ifdef WIN32 +#ifdef _WIN32 if (mkdir(p.c_str()) < 0) #else if (mkdir(p.c_str(), 0777) < 0) @@ -247,13 +247,13 @@ std::error_condition osd_file::open(std::string const &path, std::uint32_t openf { return std::errc::invalid_argument; } -#if defined(WIN32) +#if defined(_WIN32) access |= O_BINARY; #endif // convert the path into something compatible dst = path; -#if defined(WIN32) +#if defined(_WIN32) for (auto it = dst.begin(); it != dst.end(); ++it) *it = (INVPATHSEPCH == *it) ? PATHSEPCH : *it; #endif @@ -262,7 +262,7 @@ std::error_condition osd_file::open(std::string const &path, std::uint32_t openf // attempt to open the file int fd = -1; -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(_WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__) fd = ::open(dst.c_str(), access, 0666); #else fd = ::open64(dst.c_str(), access, 0666); @@ -285,7 +285,7 @@ std::error_condition osd_file::open(std::string const &path, std::uint32_t openf // attempt to reopen the file if (!createrr) { -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(_WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__) fd = ::open(dst.c_str(), access, 0666); #else fd = ::open64(dst.c_str(), access, 0666); @@ -306,7 +306,7 @@ std::error_condition osd_file::open(std::string const &path, std::uint32_t openf } // get the file size -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(_WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__) struct stat st; if (::fstat(fd, &st) < 0) #else @@ -371,7 +371,7 @@ bool osd_get_physical_drive_geometry(const char *filename, uint32_t *cylinders, std::unique_ptr<osd::directory::entry> osd_stat(const std::string &path) { -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || defined(__HAIKU__) || defined(_WIN32) || defined(SDLMAME_NO64BITIO) || defined(__ANDROID__) struct stat st; int const err = ::stat(path.c_str(), &st); #else @@ -405,7 +405,7 @@ std::error_condition osd_get_full_path(std::string &dst, std::string const &path { try { -#if defined(WIN32) +#if defined(_WIN32) std::vector<char> path_buffer(MAX_PATH); if (::_fullpath(&path_buffer[0], path.c_str(), MAX_PATH)) { @@ -465,7 +465,7 @@ bool osd_is_absolute_path(std::string const &path) noexcept { if (!path.empty() && is_path_separator(path[0])) return true; -#if !defined(WIN32) +#if !defined(_WIN32) else if (!path.empty() && (path[0] == '.') && (!path[1] || is_path_separator(path[1]))) // FIXME: why is this even here? foo/./bar is a valid way to refer to foo/bar return true; #elif !defined(UNDER_CE) @@ -509,7 +509,7 @@ bool osd_is_valid_filename_char(char32_t uchar) noexcept // The only one that's actually invalid is the slash // The other two are just problematic because they're the escape character and path separator return osd_is_valid_filepath_char(uchar) -#if defined(WIN32) +#if defined(_WIN32) && uchar != PATHSEPCH && uchar != INVPATHSEPCH #else @@ -529,7 +529,7 @@ bool osd_is_valid_filepath_char(char32_t uchar) noexcept // One could argue that colon should be in here too because it functions as path separator return uchar >= 0x20 && !(uchar >= '\x7F' && uchar <= '\x9F') -#if defined(WIN32) +#if defined(_WIN32) && uchar != '<' && uchar != '>' && uchar != '\"' |