summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2021-09-06 06:34:42 +1000
committer Vas Crabb <vas@vastheman.com>2021-09-06 06:34:42 +1000
commit4f495994c41cd2fbaf89c08f755e828ae3261828 (patch)
tree8ea2c8522b807e394ea942460687b66e3ec7e381 /src/osd
parent5e02ff231e2472e7e75a97b6e8758a070b227f8e (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')
-rw-r--r--src/osd/asio.h2
-rw-r--r--src/osd/modules/debugger/debugqt.cpp12
-rw-r--r--src/osd/modules/file/posixdir.cpp6
-rw-r--r--src/osd/modules/file/posixfile.cpp34
-rw-r--r--src/osd/modules/netdev/taptun.cpp14
-rw-r--r--src/osd/modules/sound/pa_sound.cpp4
-rw-r--r--src/osd/osdcore.cpp12
-rw-r--r--src/osd/strconv.h4
8 files changed, 44 insertions, 44 deletions
diff --git a/src/osd/asio.h b/src/osd/asio.h
index 3ee31a467d7..d59a90b8929 100644
--- a/src/osd/asio.h
+++ b/src/osd/asio.h
@@ -17,7 +17,7 @@
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
-#if defined(WIN32) && !defined(_WIN32_WINNT)
+#if defined(_WIN32) && !defined(_WIN32_WINNT)
#if defined(OSD_WINDOWS)
#define _WIN32_WINNT 0x0501
#else
diff --git a/src/osd/modules/debugger/debugqt.cpp b/src/osd/modules/debugger/debugqt.cpp
index 6731dc63e21..a48f419a6a3 100644
--- a/src/osd/modules/debugger/debugqt.cpp
+++ b/src/osd/modules/debugger/debugqt.cpp
@@ -33,7 +33,7 @@
#include "qt/deviceinformationwindow.h"
class debug_qt : public osd_module, public debug_module
-#if defined(WIN32) && !defined(SDLMAME_WIN32)
+#if defined(_WIN32) && !defined(SDLMAME_WIN32)
, public QAbstractNativeEventFilter
#endif
{
@@ -50,7 +50,7 @@ public:
virtual void init_debugger(running_machine &machine);
virtual void wait_for_debugger(device_t &device, bool firststop);
virtual void debugger_update();
-#if defined(WIN32) && !defined(SDLMAME_WIN32)
+#if defined(_WIN32) && !defined(SDLMAME_WIN32)
virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE;
#endif
private:
@@ -230,7 +230,7 @@ void bring_main_window_to_front()
// Core functionality
//============================================================
-#if defined(WIN32) && !defined(SDLMAME_WIN32)
+#if defined(_WIN32) && !defined(SDLMAME_WIN32)
bool winwindow_qt_filter(void *message);
bool debug_qt::nativeEventFilter(const QByteArray &eventType, void *message, long *)
@@ -246,7 +246,7 @@ void debug_qt::init_debugger(running_machine &machine)
{
// If you're starting from scratch, create a new qApp
new QApplication(qtArgc, qtArgv);
-#if defined(WIN32) && !defined(SDLMAME_WIN32)
+#if defined(_WIN32) && !defined(SDLMAME_WIN32)
QAbstractEventDispatcher::instance()->installNativeEventFilter(this);
#endif
}
@@ -276,7 +276,7 @@ void debug_qt::init_debugger(running_machine &machine)
#if defined(SDLMAME_UNIX) || defined(SDLMAME_WIN32)
extern int sdl_entered_debugger;
-#elif defined(WIN32)
+#elif defined(_WIN32)
void winwindow_update_cursor_state(running_machine &machine);
#endif
@@ -343,7 +343,7 @@ void debug_qt::wait_for_debugger(device_t &device, bool firststop)
// all the QT windows are already gone.
gather_save_configurations();
}
-#if defined(WIN32) && !defined(SDLMAME_WIN32)
+#if defined(_WIN32) && !defined(SDLMAME_WIN32)
winwindow_update_cursor_state(*m_machine); // make sure the cursor isn't hidden while in debugger
#endif
}
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 != '\"'
diff --git a/src/osd/modules/netdev/taptun.cpp b/src/osd/modules/netdev/taptun.cpp
index 6999d6f63ba..c0d99ec750c 100644
--- a/src/osd/modules/netdev/taptun.cpp
+++ b/src/osd/modules/netdev/taptun.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Carl
#if defined(OSD_NET_USE_TAPTUN)
-#if defined(WIN32)
+#if defined(_WIN32)
#include <windows.h>
#include <winioctl.h>
#else
@@ -23,7 +23,7 @@
#define IFF_TAP 0x0002
#define IFF_NO_PI 0x1000
#define TUNSETIFF _IOW('T', 202, int)
-#elif defined(WIN32)
+#elif defined(_WIN32)
#include "tap-windows6/tap-windows.h"
// for some reason this isn't defined in the header, and presumably it changes
@@ -62,7 +62,7 @@ public:
protected:
int recv_dev(uint8_t **buf) override;
private:
-#if defined(WIN32)
+#if defined(_WIN32)
HANDLE m_handle = INVALID_HANDLE_VALUE;
OVERLAPPED m_overlapped;
bool m_receive_pending;
@@ -98,7 +98,7 @@ netdev_tap::netdev_tap(const char *name, class device_network_interface *ifdev,
osd_printf_verbose("netdev_tap: network up!\n");
strncpy(m_ifname, ifr.ifr_name, 10);
fcntl(m_fd, F_SETFL, O_NONBLOCK);
-#elif defined(WIN32)
+#elif defined(_WIN32)
std::wstring device_path(L"" USERMODEDEVICEDIR);
device_path.append(wstring_from_utf8(name));
device_path.append(L"" TAP_WIN_SUFFIX);
@@ -121,7 +121,7 @@ netdev_tap::netdev_tap(const char *name, class device_network_interface *ifdev,
netdev_tap::~netdev_tap()
{
-#if defined(WIN32)
+#if defined(_WIN32)
if (m_handle != INVALID_HANDLE_VALUE)
{
if (m_receive_pending)
@@ -169,7 +169,7 @@ static u32 finalise_frame(u8 buf[], u32 length)
return length;
}
-#if defined(WIN32)
+#if defined(_WIN32)
int netdev_tap::send(uint8_t *buf, int len)
{
OVERLAPPED overlapped = {};
@@ -344,7 +344,7 @@ static CREATE_NETDEV(create_tap)
int taptun_module::init(const osd_options &options)
{
-#if defined(WIN32)
+#if defined(_WIN32)
for (std::wstring &id : get_tap_adapters())
add_netdev(utf8_from_wstring(id).c_str(), utf8_from_wstring(get_connection_name(id)).c_str(), create_tap);
#else
diff --git a/src/osd/modules/sound/pa_sound.cpp b/src/osd/modules/sound/pa_sound.cpp
index c71852df8e8..ce191b6086a 100644
--- a/src/osd/modules/sound/pa_sound.cpp
+++ b/src/osd/modules/sound/pa_sound.cpp
@@ -24,7 +24,7 @@
#include <climits>
#include <algorithm>
-#ifdef WIN32
+#ifdef _WIN32
#include "pa_win_wasapi.h"
#endif
@@ -216,7 +216,7 @@ int sound_pa::init(osd_options const &options)
// 0 = use default
stream_params.suggestedLatency = options.pa_latency() ? options.pa_latency() : device_info->defaultLowOutputLatency;
-#ifdef WIN32
+#ifdef _WIN32
PaWasapiStreamInfo wasapi_stream_info;
// if requested latency is less than 20 ms, we need to use exclusive mode
diff --git a/src/osd/osdcore.cpp b/src/osd/osdcore.cpp
index f883e50f321..f5860416381 100644
--- a/src/osd/osdcore.cpp
+++ b/src/osd/osdcore.cpp
@@ -139,7 +139,7 @@ void osd_vprintf_debug(util::format_argument_pack<std::ostream> const &args)
osd_ticks_t osd_ticks()
{
-#ifdef WIN32
+#ifdef _WIN32
LARGE_INTEGER val;
QueryPerformanceCounter(&val);
return val.QuadPart;
@@ -155,7 +155,7 @@ osd_ticks_t osd_ticks()
osd_ticks_t osd_ticks_per_second()
{
-#ifdef WIN32
+#ifdef _WIN32
LARGE_INTEGER val;
QueryPerformanceFrequency(&val);
return val.QuadPart;
@@ -170,7 +170,7 @@ osd_ticks_t osd_ticks_per_second()
void osd_sleep(osd_ticks_t duration)
{
-#ifdef WIN32
+#ifdef _WIN32
// sleep_for appears to oversleep on Windows with gcc 8
Sleep(duration / (osd_ticks_per_second() / 1000));
#else
@@ -190,7 +190,7 @@ void osd_sleep(osd_ticks_t duration)
std::vector<std::string> osd_get_command_line(int argc, char *argv[])
{
std::vector<std::string> results;
-#ifdef WIN32
+#ifdef _WIN32
{
// Get the command line from Windows
int count;
@@ -206,7 +206,7 @@ std::vector<std::string> osd_get_command_line(int argc, char *argv[])
LocalFree(wide_args);
}
-#else // !WIN32
+#else // !_WIN32
{
// for non Windows platforms, we are assuming that arguments are
// already UTF-8; we just need to convert to std::vector<std::string>
@@ -214,6 +214,6 @@ std::vector<std::string> osd_get_command_line(int argc, char *argv[])
for (int i = 0; i < argc; i++)
results.emplace_back(argv[i]);
}
-#endif // WIN32
+#endif // _WIN32
return results;
}
diff --git a/src/osd/strconv.h b/src/osd/strconv.h
index f1eed54a49a..3843ee00f98 100644
--- a/src/osd/strconv.h
+++ b/src/osd/strconv.h
@@ -17,7 +17,7 @@
// FUNCTION PROTOTYPES
//============================================================
-#if defined(WIN32)
+#if defined(_WIN32)
#include <windows.h>
@@ -56,7 +56,7 @@ typedef std::string tstring;
}
}
-#endif // defined(WIN32)
+#endif // defined(_WIN32)
#endif // MAME_OSD_STRCONV_H