summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-10-22 11:31:49 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-10-22 11:31:49 +0200
commit23ad94073f4c2f7131fa0c95b6202f2f9027db41 (patch)
tree4f4e1e27a22ace8fea49b63030d4462db7cb68a1 /src/osd
parent255bf78b316a9dc9e4c53a65143000471a6927d3 (diff)
use standard types uintptr_t, char16_t and char32_t instead of FPTR, utf16_char, unicode_char (nw)
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/modules/debugger/win/debugviewinfo.cpp2
-rw-r--r--src/osd/modules/debugger/win/debugwininfo.cpp2
-rw-r--r--src/osd/modules/debugger/win/editwininfo.cpp4
-rw-r--r--src/osd/modules/diagnostics/diagnostics_win32.cpp92
-rw-r--r--src/osd/modules/file/posixfile.cpp4
-rw-r--r--src/osd/modules/file/stdfile.cpp2
-rw-r--r--src/osd/modules/file/winfile.cpp4
-rw-r--r--src/osd/modules/font/font_dwrite.cpp2
-rw-r--r--src/osd/modules/font/font_none.cpp2
-rw-r--r--src/osd/modules/font/font_osx.cpp4
-rw-r--r--src/osd/modules/font/font_sdl.cpp4
-rw-r--r--src/osd/modules/font/font_windows.cpp6
-rw-r--r--src/osd/modules/input/input_dinput.cpp16
-rw-r--r--src/osd/modules/input/input_sdl.cpp2
-rw-r--r--src/osd/modules/lib/osdlib_win32.cpp4
-rw-r--r--src/osd/modules/opengl/gl_shader_tool.cpp22
-rw-r--r--src/osd/modules/render/blit13.h4
-rw-r--r--src/osd/modules/render/drawd3d.cpp2
-rw-r--r--src/osd/osdcomm.h11
-rw-r--r--src/osd/osdcore.h6
-rw-r--r--src/osd/osdepend.h2
-rw-r--r--src/osd/strconv.cpp4
-rw-r--r--src/osd/windows/window.cpp2
23 files changed, 96 insertions, 107 deletions
diff --git a/src/osd/modules/debugger/win/debugviewinfo.cpp b/src/osd/modules/debugger/win/debugviewinfo.cpp
index be786b33fa2..122e5649858 100644
--- a/src/osd/modules/debugger/win/debugviewinfo.cpp
+++ b/src/osd/modules/debugger/win/debugviewinfo.cpp
@@ -773,7 +773,7 @@ LRESULT CALLBACK debugview_info::static_view_proc(HWND wnd, UINT message, WPARAM
return 0;
}
- debugview_info *const info = (debugview_info *)(FPTR)GetWindowLongPtr(wnd, GWLP_USERDATA);
+ debugview_info *const info = (debugview_info *)(uintptr_t)GetWindowLongPtr(wnd, GWLP_USERDATA);
if (info == nullptr)
return DefWindowProc(wnd, message, wparam, lparam);
diff --git a/src/osd/modules/debugger/win/debugwininfo.cpp b/src/osd/modules/debugger/win/debugwininfo.cpp
index fda0a1144fc..3b2e9ed9689 100644
--- a/src/osd/modules/debugger/win/debugwininfo.cpp
+++ b/src/osd/modules/debugger/win/debugwininfo.cpp
@@ -563,7 +563,7 @@ LRESULT CALLBACK debugwin_info::static_window_proc(HWND wnd, UINT message, WPARA
return 0;
}
- debugwin_info *const info = (debugwin_info *)(FPTR)GetWindowLongPtr(wnd, GWLP_USERDATA);
+ debugwin_info *const info = (debugwin_info *)(uintptr_t)GetWindowLongPtr(wnd, GWLP_USERDATA);
if (info == nullptr)
return DefWindowProc(wnd, message, wparam, lparam);
diff --git a/src/osd/modules/debugger/win/editwininfo.cpp b/src/osd/modules/debugger/win/editwininfo.cpp
index e7c3ba4f54d..6dc4954a796 100644
--- a/src/osd/modules/debugger/win/editwininfo.cpp
+++ b/src/osd/modules/debugger/win/editwininfo.cpp
@@ -35,7 +35,7 @@ editwin_info::editwin_info(debugger_windows_interface &debugger, bool is_main_co
// create an edit box and override its key handling
m_editwnd = CreateWindowEx(EDIT_BOX_STYLE_EX, TEXT("EDIT"), nullptr, EDIT_BOX_STYLE,
0, 0, 100, 100, window(), nullptr, GetModuleHandleUni(), nullptr);
- m_original_editproc = (WNDPROC)(FPTR)GetWindowLongPtr(m_editwnd, GWLP_WNDPROC);
+ m_original_editproc = (WNDPROC)(uintptr_t)GetWindowLongPtr(m_editwnd, GWLP_WNDPROC);
SetWindowLongPtr(m_editwnd, GWLP_USERDATA, (LONG_PTR)this);
SetWindowLongPtr(m_editwnd, GWLP_WNDPROC, (LONG_PTR)&editwin_info::static_edit_proc);
SendMessage(m_editwnd, WM_SETFONT, (WPARAM)metrics().debug_font(), (LPARAM)FALSE);
@@ -226,7 +226,7 @@ LRESULT editwin_info::edit_proc(UINT message, WPARAM wparam, LPARAM lparam)
LRESULT CALLBACK editwin_info::static_edit_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
{
- editwin_info *const info = (editwin_info *)(FPTR)GetWindowLongPtr(wnd, GWLP_USERDATA);
+ editwin_info *const info = (editwin_info *)(uintptr_t)GetWindowLongPtr(wnd, GWLP_USERDATA);
assert(info->m_editwnd == wnd);
return info->edit_proc(message, wparam, lparam);
}
diff --git a/src/osd/modules/diagnostics/diagnostics_win32.cpp b/src/osd/modules/diagnostics/diagnostics_win32.cpp
index cdacba72ceb..aa74e60adc4 100644
--- a/src/osd/modules/diagnostics/diagnostics_win32.cpp
+++ b/src/osd/modules/diagnostics/diagnostics_win32.cpp
@@ -46,9 +46,9 @@ class stack_walker
public:
stack_walker();
- FPTR ip() const { return m_stackframe.AddrPC.Offset; }
- FPTR sp() const { return m_stackframe.AddrStack.Offset; }
- FPTR frame() const { return m_stackframe.AddrFrame.Offset; }
+ uintptr_t ip() const { return m_stackframe.AddrPC.Offset; }
+ uintptr_t sp() const { return m_stackframe.AddrStack.Offset; }
+ uintptr_t frame() const { return m_stackframe.AddrFrame.Offset; }
bool reset();
void reset(CONTEXT &context, HANDLE thread);
@@ -82,11 +82,11 @@ public:
~symbol_manager();
// getters
- FPTR last_base() const { return m_last_base; }
+ uintptr_t last_base() const { return m_last_base; }
// core symbol lookup
- const char *symbol_for_address(FPTR address);
- const char *symbol_for_address(PVOID address) { return symbol_for_address(reinterpret_cast<FPTR>(address)); }
+ const char *symbol_for_address(uintptr_t address);
+ const char *symbol_for_address(PVOID address) { return symbol_for_address(reinterpret_cast<uintptr_t>(address)); }
// force symbols to be cached
void cache_symbols() { scan_file_for_address(0, true); }
@@ -94,21 +94,21 @@ public:
void reset_cache() { m_cache.clear(); }
private:
// internal helpers
- bool query_system_for_address(FPTR address);
- void scan_file_for_address(FPTR address, bool create_cache);
- bool parse_sym_line(const char *line, FPTR &address, std::string &symbol);
- bool parse_map_line(const char *line, FPTR &address, std::string &symbol);
- void scan_cache_for_address(FPTR address);
+ bool query_system_for_address(uintptr_t address);
+ void scan_file_for_address(uintptr_t address, bool create_cache);
+ bool parse_sym_line(const char *line, uintptr_t &address, std::string &symbol);
+ bool parse_map_line(const char *line, uintptr_t &address, std::string &symbol);
+ void scan_cache_for_address(uintptr_t address);
void format_symbol(const char *name, UINT32 displacement, const char *filename = nullptr, int linenumber = 0);
- static FPTR get_text_section_base();
+ static uintptr_t get_text_section_base();
struct cache_entry
{
- cache_entry(FPTR address, const char *symbol) :
+ cache_entry(uintptr_t address, const char *symbol) :
m_address(address), m_name(symbol) { }
- FPTR m_address;
+ uintptr_t m_address;
std::string m_name;
};
std::vector<std::unique_ptr<cache_entry>> m_cache;
@@ -117,8 +117,8 @@ private:
std::string m_symfile;
std::string m_buffer;
HANDLE m_process;
- FPTR m_last_base;
- FPTR m_text_base;
+ uintptr_t m_last_base;
+ uintptr_t m_text_base;
osd::dynamic_module::ptr m_dbghelp_dll;
@@ -153,9 +153,9 @@ private:
UINT8 m_stack_depth;
UINT8 m_entry_stride;
- std::vector<FPTR> m_buffer;
- FPTR * m_buffer_ptr;
- FPTR * m_buffer_end;
+ std::vector<uintptr_t> m_buffer;
+ uintptr_t * m_buffer_ptr;
+ uintptr_t * m_buffer_end;
};
@@ -338,7 +338,7 @@ symbol_manager::~symbol_manager()
// file
//-------------------------------------------------
-const char *symbol_manager::symbol_for_address(FPTR address)
+const char *symbol_manager::symbol_for_address(uintptr_t address)
{
// default the buffer
m_buffer.assign(" (not found)");
@@ -364,7 +364,7 @@ const char *symbol_manager::symbol_for_address(FPTR address)
// look up our address
//-------------------------------------------------
-bool symbol_manager::query_system_for_address(FPTR address)
+bool symbol_manager::query_system_for_address(uintptr_t address)
{
// need at least the sym_from_addr API
if (!m_sym_from_addr)
@@ -402,7 +402,7 @@ bool symbol_manager::query_system_for_address(FPTR address)
// along the way
//-------------------------------------------------
-void symbol_manager::scan_file_for_address(FPTR address, bool create_cache)
+void symbol_manager::scan_file_for_address(uintptr_t address, bool create_cache)
{
bool is_symfile = false;
FILE *srcfile = nullptr;
@@ -423,7 +423,7 @@ void symbol_manager::scan_file_for_address(FPTR address, bool create_cache)
// reset the best info
std::string best_symbol;
- FPTR best_addr = 0;
+ uintptr_t best_addr = 0;
// parse the file, looking for valid entries
std::string symbol;
@@ -431,7 +431,7 @@ void symbol_manager::scan_file_for_address(FPTR address, bool create_cache)
while (fgets(line, sizeof(line) - 1, srcfile))
{
// parse the line looking for an interesting symbol
- FPTR addr = 0;
+ uintptr_t addr = 0;
bool valid = is_symfile ? parse_sym_line(line, addr, symbol) : parse_map_line(line, addr, symbol);
// if we got one, see if this is the best
@@ -464,11 +464,11 @@ void symbol_manager::scan_file_for_address(FPTR address, bool create_cache)
// find the best match for the given address
//-------------------------------------------------
-void symbol_manager::scan_cache_for_address(FPTR address)
+void symbol_manager::scan_cache_for_address(uintptr_t address)
{
// reset the best info
std::string best_symbol;
- FPTR best_addr = 0;
+ uintptr_t best_addr = 0;
// walk the cache, looking for valid entries
for (auto &entry : m_cache)
@@ -491,7 +491,7 @@ void symbol_manager::scan_cache_for_address(FPTR address)
// which is just the output of objdump
//-------------------------------------------------
-bool symbol_manager::parse_sym_line(const char *line, FPTR &address, std::string &symbol)
+bool symbol_manager::parse_sym_line(const char *line, uintptr_t &address, std::string &symbol)
{
#ifdef __GNUC__
/*
@@ -524,7 +524,7 @@ bool symbol_manager::parse_sym_line(const char *line, FPTR &address, std::string
void *temp;
if (sscanf(chptr, "0x%p", &temp) != 1)
return false;
- address = m_text_base + reinterpret_cast<FPTR>(temp);
+ address = m_text_base + reinterpret_cast<uintptr_t>(temp);
// skip forward until we're past the space
while (*chptr != 0 && !isspace(*chptr))
@@ -545,7 +545,7 @@ bool symbol_manager::parse_sym_line(const char *line, FPTR &address, std::string
// generated map file
//-------------------------------------------------
-bool symbol_manager::parse_map_line(const char *line, FPTR &address, std::string &symbol)
+bool symbol_manager::parse_map_line(const char *line, uintptr_t &address, std::string &symbol)
{
#ifdef __GNUC__
/*
@@ -563,7 +563,7 @@ bool symbol_manager::parse_map_line(const char *line, FPTR &address, std::string
void *temp;
if (sscanf(&line[16], "0x%p", &temp) != 1)
return false;
- address = reinterpret_cast<FPTR>(temp);
+ address = reinterpret_cast<uintptr_t>(temp);
// skip forward until we're past the space
const char *chptr = &line[16];
@@ -604,7 +604,7 @@ void symbol_manager::format_symbol(const char *name, UINT32 displacement, const
// of the .text section
//-------------------------------------------------
-FPTR symbol_manager::get_text_section_base()
+uintptr_t symbol_manager::get_text_section_base()
{
osd::dynamic_module::ptr m_dbghelp_dll = osd::dynamic_module::open({ "dbghelp.dll" });
@@ -623,13 +623,13 @@ FPTR symbol_manager::get_text_section_base()
assert(headers != nullptr);
// look ourself up (assuming we are in the .text section)
- PIMAGE_SECTION_HEADER section = (*image_rva_to_section)(headers, base, reinterpret_cast<FPTR>(get_text_section_base) - reinterpret_cast<FPTR>(base));
+ PIMAGE_SECTION_HEADER section = (*image_rva_to_section)(headers, base, reinterpret_cast<uintptr_t>(get_text_section_base) - reinterpret_cast<uintptr_t>(base));
if (section != nullptr)
- return reinterpret_cast<FPTR>(base) + section->VirtualAddress;
+ return reinterpret_cast<uintptr_t>(base) + section->VirtualAddress;
}
// fallback to returning the image base (wrong)
- return reinterpret_cast<FPTR>(base);
+ return reinterpret_cast<uintptr_t>(base);
}
@@ -710,8 +710,8 @@ void sampling_profiler::stop()
int CLIB_DECL sampling_profiler::compare_address(const void *item1, const void *item2)
{
- const FPTR *entry1 = reinterpret_cast<const FPTR *>(item1);
- const FPTR *entry2 = reinterpret_cast<const FPTR *>(item2);
+ const uintptr_t *entry1 = reinterpret_cast<const uintptr_t *>(item1);
+ const uintptr_t *entry2 = reinterpret_cast<const uintptr_t *>(item2);
int mincount = std::min(entry1[0], entry2[0]);
// sort in order of: bucket, caller, caller's caller, etc.
@@ -731,8 +731,8 @@ int CLIB_DECL sampling_profiler::compare_address(const void *item1, const void *
int CLIB_DECL sampling_profiler::compare_frequency(const void *item1, const void *item2)
{
- const FPTR *entry1 = reinterpret_cast<const FPTR *>(item1);
- const FPTR *entry2 = reinterpret_cast<const FPTR *>(item2);
+ const uintptr_t *entry1 = reinterpret_cast<const uintptr_t *>(item1);
+ const uintptr_t *entry2 = reinterpret_cast<const uintptr_t *>(item2);
// sort by frequency, then by address
if (entry1[0] != entry2[0])
@@ -751,7 +751,7 @@ void sampling_profiler::print_results(symbol_manager &symbols)
symbols.cache_symbols();
// step 1: find the base of each entry
- for (FPTR *current = &m_buffer[0]; current < m_buffer_ptr; current += m_entry_stride)
+ for (uintptr_t *current = &m_buffer[0]; current < m_buffer_ptr; current += m_entry_stride)
{
assert(current[0] >= 1 && current[0] < m_entry_stride);
@@ -761,14 +761,14 @@ void sampling_profiler::print_results(symbol_manager &symbols)
}
// step 2: sort the results
- qsort(&m_buffer[0], (m_buffer_ptr - &m_buffer[0]) / m_entry_stride, m_entry_stride * sizeof(FPTR), compare_address);
+ qsort(&m_buffer[0], (m_buffer_ptr - &m_buffer[0]) / m_entry_stride, m_entry_stride * sizeof(uintptr_t), compare_address);
// step 3: count and collapse unique entries
UINT32 total_count = 0;
- for (FPTR *current = &m_buffer[0]; current < m_buffer_ptr; )
+ for (uintptr_t *current = &m_buffer[0]; current < m_buffer_ptr; )
{
int count = 1;
- FPTR *scan;
+ uintptr_t *scan;
for (scan = current + m_entry_stride; scan < m_buffer_ptr; scan += m_entry_stride)
{
if (compare_address(current, scan) != 0)
@@ -782,11 +782,11 @@ void sampling_profiler::print_results(symbol_manager &symbols)
}
// step 4: sort the results again, this time by frequency
- qsort(&m_buffer[0], (m_buffer_ptr - &m_buffer[0]) / m_entry_stride, m_entry_stride * sizeof(FPTR), compare_frequency);
+ qsort(&m_buffer[0], (m_buffer_ptr - &m_buffer[0]) / m_entry_stride, m_entry_stride * sizeof(uintptr_t), compare_frequency);
// step 5: print the results
UINT32 num_printed = 0;
- for (FPTR *current = &m_buffer[0]; current < m_buffer_ptr && num_printed < 30; current += m_entry_stride)
+ for (uintptr_t *current = &m_buffer[0]; current < m_buffer_ptr && num_printed < 30; current += m_entry_stride)
{
// once we hit 0 frequency, we're done
if (current[0] == 0)
@@ -837,7 +837,7 @@ void sampling_profiler::thread_run()
GetThreadContext(m_target_thread, &context);
// first entry is a count
- FPTR *count = m_buffer_ptr++;
+ uintptr_t *count = m_buffer_ptr++;
*count = 0;
// iterate over the frames until we run out or hit an error
@@ -972,7 +972,7 @@ private:
auto diagnostics = downcast<diagnostics_win32 *>(get_instance());
fprintf(stderr, "Exception at EIP=%p%s: %s\n", info->ExceptionRecord->ExceptionAddress,
- diagnostics->m_symbols->symbol_for_address((FPTR)info->ExceptionRecord->ExceptionAddress), exception_table[i].string);
+ diagnostics->m_symbols->symbol_for_address((uintptr_t)info->ExceptionRecord->ExceptionAddress), exception_table[i].string);
// for access violations, print more info
if (info->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
diff --git a/src/osd/modules/file/posixfile.cpp b/src/osd/modules/file/posixfile.cpp
index 09ed0ac7984..940acef38d5 100644
--- a/src/osd/modules/file/posixfile.cpp
+++ b/src/osd/modules/file/posixfile.cpp
@@ -474,7 +474,7 @@ const char *osd_get_volume_name(int idx)
// osd_is_valid_filename_char
//============================================================
-bool osd_is_valid_filename_char(unicode_char uchar)
+bool osd_is_valid_filename_char(char32_t uchar)
{
// 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
@@ -494,7 +494,7 @@ bool osd_is_valid_filename_char(unicode_char uchar)
// osd_is_valid_filepath_char
//============================================================
-bool osd_is_valid_filepath_char(unicode_char uchar)
+bool osd_is_valid_filepath_char(char32_t uchar)
{
// One could argue that colon should be in here too because it functions as path separator
return uchar >= 0x20
diff --git a/src/osd/modules/file/stdfile.cpp b/src/osd/modules/file/stdfile.cpp
index 92920bba495..74cd6abc0c3 100644
--- a/src/osd/modules/file/stdfile.cpp
+++ b/src/osd/modules/file/stdfile.cpp
@@ -179,7 +179,7 @@ int osd_get_physical_drive_geometry(const char *filename, UINT32 *cylinders, UIN
// osd_uchar_from_osdchar
//============================================================
-int osd_uchar_from_osdchar(UINT32 /* unicode_char */ *uchar, const char *osdchar, size_t count)
+int osd_uchar_from_osdchar(char32_t *uchar, const char *osdchar, size_t count)
{
// we assume a standard 1:1 mapping of characters to the first 256 unicode characters
*uchar = (UINT8)*osdchar;
diff --git a/src/osd/modules/file/winfile.cpp b/src/osd/modules/file/winfile.cpp
index 656ce36eadc..3d61374e8c8 100644
--- a/src/osd/modules/file/winfile.cpp
+++ b/src/osd/modules/file/winfile.cpp
@@ -434,7 +434,7 @@ const char *osd_get_volume_name(int idx)
// osd_is_valid_filename_char
//============================================================
-bool osd_is_valid_filename_char(unicode_char uchar)
+bool osd_is_valid_filename_char(char32_t uchar)
{
return osd_is_valid_filepath_char(uchar)
&& uchar != '/'
@@ -448,7 +448,7 @@ bool osd_is_valid_filename_char(unicode_char uchar)
// osd_is_valid_filepath_char
//============================================================
-bool osd_is_valid_filepath_char(unicode_char uchar)
+bool osd_is_valid_filepath_char(char32_t uchar)
{
return uchar >= 0x20
&& uchar != '<'
diff --git a/src/osd/modules/font/font_dwrite.cpp b/src/osd/modules/font/font_dwrite.cpp
index af9f83bdf89..643c1f9b522 100644
--- a/src/osd/modules/font/font_dwrite.cpp
+++ b/src/osd/modules/font/font_dwrite.cpp
@@ -400,7 +400,7 @@ public:
// pixel of a black & white font
//-------------------------------------------------
- virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs) override
+ virtual bool get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs) override
{
const int MEM_ALIGN_CONST = 31;
const int BITMAP_PAD = 50;
diff --git a/src/osd/modules/font/font_none.cpp b/src/osd/modules/font/font_none.cpp
index 2716b52cf8e..dc6116625a8 100644
--- a/src/osd/modules/font/font_none.cpp
+++ b/src/osd/modules/font/font_none.cpp
@@ -15,7 +15,7 @@ public:
virtual bool open(std::string const &font_path, std::string const &name, int &height) override { return false; }
virtual void close() override { }
- virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs) override { return false; }
+ virtual bool get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs) override { return false; }
};
class font_none : public osd_module, public font_module
diff --git a/src/osd/modules/font/font_osx.cpp b/src/osd/modules/font/font_osx.cpp
index 22662d3b8d3..e0ec07be502 100644
--- a/src/osd/modules/font/font_osx.cpp
+++ b/src/osd/modules/font/font_osx.cpp
@@ -30,7 +30,7 @@ public:
virtual bool open(std::string const &font_path, std::string const &name, int &height);
virtual void close();
- virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs);
+ virtual bool get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs);
osd_font_osx &operator=(osd_font_osx &&obj)
{
@@ -122,7 +122,7 @@ void osd_font_osx::close()
// pixel of a black & white font
//-------------------------------------------------
-bool osd_font_osx::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs)
+bool osd_font_osx::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs)
{
UniChar uni_char;
CGGlyph glyph;
diff --git a/src/osd/modules/font/font_sdl.cpp b/src/osd/modules/font/font_sdl.cpp
index 629bc9046a8..668fd2d5778 100644
--- a/src/osd/modules/font/font_sdl.cpp
+++ b/src/osd/modules/font/font_sdl.cpp
@@ -39,7 +39,7 @@ public:
virtual bool open(std::string const &font_path, std::string const &name, int &height);
virtual void close();
- virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs);
+ virtual bool get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs);
osd_font_sdl & operator=(osd_font_sdl &&obj)
{
@@ -158,7 +158,7 @@ void osd_font_sdl::close()
// pixel of a black & white font
//-------------------------------------------------
-bool osd_font_sdl::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs)
+bool osd_font_sdl::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs)
{
SDL_Color const fcol = { 0xff, 0xff, 0xff };
char ustr[16];
diff --git a/src/osd/modules/font/font_windows.cpp b/src/osd/modules/font/font_windows.cpp
index 9fd326f8c57..e6de2ef693d 100644
--- a/src/osd/modules/font/font_windows.cpp
+++ b/src/osd/modules/font/font_windows.cpp
@@ -38,7 +38,7 @@ public:
virtual bool open(std::string const &font_path, std::string const &name, int &height) override;
virtual void close() override;
- virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs) override;
+ virtual bool get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs) override;
osd_font_windows &operator=(osd_font_windows &&obj)
{
@@ -144,7 +144,7 @@ void osd_font_windows::close()
// pixel of a black & white font
//-------------------------------------------------
-bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
+bool osd_font_windows::get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
{
// create a dummy DC to work with
HDC dummyDC = CreateCompatibleDC(nullptr);
@@ -200,7 +200,7 @@ bool osd_font_windows::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT
memset(bits, 0, rowbytes * bmheight);
// now draw the character
- utf16_char tempchar[UTF16_CHAR_MAX];
+ char16_t tempchar[UTF16_CHAR_MAX];
UINT const count = INT(utf16_from_uchar(tempchar, ARRAY_LENGTH(tempchar), chnum));
SetTextColor(dummyDC, RGB(0xff, 0xff, 0xff));
SetBkColor(dummyDC, RGB(0x00, 0x00, 0x00));
diff --git a/src/osd/modules/input/input_dinput.cpp b/src/osd/modules/input/input_dinput.cpp
index c4a62cd0d2f..694bf80b984 100644
--- a/src/osd/modules/input/input_dinput.cpp
+++ b/src/osd/modules/input/input_dinput.cpp
@@ -406,7 +406,7 @@ public:
// populate the buttons
for (butnum = 0; butnum < devinfo->dinput.caps.dwButtons; butnum++)
{
- FPTR offset = reinterpret_cast<FPTR>(&static_cast<DIMOUSESTATE *>(nullptr)->rgbButtons[butnum]);
+ uintptr_t offset = reinterpret_cast<uintptr_t>(&static_cast<DIMOUSESTATE *>(nullptr)->rgbButtons[butnum]);
// add to the mouse device
std::string name = device_item_name(devinfo, offset, default_button_name(butnum), nullptr);
@@ -520,25 +520,25 @@ int dinput_joystick_device::configure()
// left
name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("L"));
- device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_LEFT)));
+ device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<uintptr_t>(povnum * 4 + POVDIR_LEFT)));
// right
name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("R"));
- device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_RIGHT)));
+ device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<uintptr_t>(povnum * 4 + POVDIR_RIGHT)));
// up
name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("U"));
- device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_UP)));
+ device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<uintptr_t>(povnum * 4 + POVDIR_UP)));
// down
name = dinput_module::device_item_name(this, offsetof(DIJOYSTATE2, rgdwPOV) + povnum * sizeof(DWORD), default_pov_name(povnum), TEXT("D"));
- device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<FPTR>(povnum * 4 + POVDIR_DOWN)));
+ device()->add_item(name.c_str(), ITEM_ID_OTHER_SWITCH, dinput_joystick_pov_get_state, reinterpret_cast<void *>(static_cast<uintptr_t>(povnum * 4 + POVDIR_DOWN)));
}
// populate the buttons
for (UINT32 butnum = 0; butnum < dinput.caps.dwButtons; butnum++)
{
- FPTR offset = reinterpret_cast<FPTR>(&static_cast<DIJOYSTATE2 *>(nullptr)->rgbButtons[butnum]);
+ uintptr_t offset = reinterpret_cast<uintptr_t>(&static_cast<DIJOYSTATE2 *>(nullptr)->rgbButtons[butnum]);
std::string name = dinput_module::device_item_name(this, offset, default_button_name(butnum), nullptr);
input_item_id itemid;
@@ -606,8 +606,8 @@ public:
static INT32 dinput_joystick_pov_get_state(void *device_internal, void *item_internal)
{
dinput_joystick_device *devinfo = static_cast<dinput_joystick_device *>(device_internal);
- int povnum = reinterpret_cast<FPTR>(item_internal) / 4;
- int povdir = reinterpret_cast<FPTR>(item_internal) % 4;
+ int povnum = reinterpret_cast<uintptr_t>(item_internal) / 4;
+ int povdir = reinterpret_cast<uintptr_t>(item_internal) % 4;
INT32 result = 0;
DWORD pov;
diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp
index 9a8180b7088..d42e17274eb 100644
--- a/src/osd/modules/input/input_sdl.cpp
+++ b/src/osd/modules/input/input_sdl.cpp
@@ -163,7 +163,7 @@ public:
auto len = std::strlen(sdlevent.text.text);
while (len)
{
- unicode_char ch;
+ char32_t ch;
auto chlen = uchar_from_utf8(&ch, ptr, len);
if (0 > chlen)
{
diff --git a/src/osd/modules/lib/osdlib_win32.cpp b/src/osd/modules/lib/osdlib_win32.cpp
index 503aaec9b7a..89e0cacf37d 100644
--- a/src/osd/modules/lib/osdlib_win32.cpp
+++ b/src/osd/modules/lib/osdlib_win32.cpp
@@ -123,7 +123,7 @@ void *osd_malloc(size_t size)
UINT8 *const block = reinterpret_cast<UINT8 *>(HeapAlloc(GetProcessHeap(), 0, size));
if (block == nullptr)
return nullptr;
- UINT8 *const result = reinterpret_cast<UINT8 *>(reinterpret_cast<FPTR>(block + sizeof(size_t) + MAX_ALIGNMENT) & ~(FPTR(MAX_ALIGNMENT) - 1));
+ UINT8 *const result = reinterpret_cast<UINT8 *>(reinterpret_cast<uintptr_t>(block + sizeof(size_t) + MAX_ALIGNMENT) & ~(uintptr_t(MAX_ALIGNMENT) - 1));
// store the size and return and pointer to the data afterward
*reinterpret_cast<size_t *>(block) = size;
@@ -161,7 +161,7 @@ void *osd_malloc_array(size_t size)
// work backwards from the page base to get to the block base
UINT8 *const block = GUARD_ALIGN_START ? reinterpret_cast<UINT8 *>(page_base) : (reinterpret_cast<UINT8 *>(page_base) + rounded_size - size);
- UINT8 *const result = reinterpret_cast<UINT8 *>(reinterpret_cast<FPTR>(block + sizeof(size_t) + MAX_ALIGNMENT) & ~(FPTR(MAX_ALIGNMENT) - 1));
+ UINT8 *const result = reinterpret_cast<UINT8 *>(reinterpret_cast<uintptr_t>(block + sizeof(size_t) + MAX_ALIGNMENT) & ~(uintptr_t(MAX_ALIGNMENT) - 1));
// store the size at the start with a flag indicating it has a guard page
*reinterpret_cast<size_t *>(block) = size | 1;
diff --git a/src/osd/modules/opengl/gl_shader_tool.cpp b/src/osd/modules/opengl/gl_shader_tool.cpp
index 5ee07661aa9..33cbac2d129 100644
--- a/src/osd/modules/opengl/gl_shader_tool.cpp
+++ b/src/osd/modules/opengl/gl_shader_tool.cpp
@@ -152,57 +152,57 @@ int gl_shader_check_error(GLhandleARB obj, GLenum obj_query, GLSLCheckMode m, co
if( param!=GL_PROGRAM_OBJECT_ARB && param!=GL_SHADER_OBJECT_ARB )
{
if ( CHECK_VERBOSE <= m )
- osd_printf_warning("%s:%d: GL Error: object type 0x%X generation failed\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Error: object type 0x%X generation failed\n", file, line, (unsigned int)(uintptr_t)obj);
res=-1;
} else if ( CHECK_ALWAYS_VERBOSE <= m )
{
if(param==GL_PROGRAM_OBJECT_ARB)
- osd_printf_warning("%s:%d: GL Error: object type 0x%X is PROGRAM, successful\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Error: object type 0x%X is PROGRAM, successful\n", file, line, (unsigned int)(uintptr_t)obj);
else
- osd_printf_warning("%s:%d: GL Info: object type 0x%X is SHADER, successful\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Info: object type 0x%X is SHADER, successful\n", file, line, (unsigned int)(uintptr_t)obj);
}
break;
case GL_OBJECT_DELETE_STATUS_ARB:
if(param!=1)
{
if ( CHECK_ALWAYS_VERBOSE <= m )
- osd_printf_warning("%s:%d: GL Info: object 0x%X not yet marked for deletion\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Info: object 0x%X not yet marked for deletion\n", file, line, (unsigned int)(uintptr_t)obj);
} else if ( CHECK_ALWAYS_VERBOSE <= m )
{
- osd_printf_warning("%s:%d: GL Info: object 0x%X deletion successful\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Info: object 0x%X deletion successful\n", file, line, (unsigned int)(uintptr_t)obj);
}
break;
case GL_OBJECT_COMPILE_STATUS_ARB:
if(param!=1)
{
if ( CHECK_VERBOSE <= m )
- osd_printf_warning("%s:%d: GL Error: object 0x%X compilation failed\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Error: object 0x%X compilation failed\n", file, line, (unsigned int)(uintptr_t)obj);
res=-1;
} else if ( CHECK_ALWAYS_VERBOSE <= m )
{
- osd_printf_warning("%s:%d: GL Info: object 0x%X compiled successful\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Info: object 0x%X compiled successful\n", file, line, (unsigned int)(uintptr_t)obj);
}
break;
case GL_OBJECT_LINK_STATUS_ARB:
if(param!=1)
{
if ( CHECK_VERBOSE <= m )
- osd_printf_warning("%s:%d: GL Error: object 0x%X linking failed\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Error: object 0x%X linking failed\n", file, line, (unsigned int)(uintptr_t)obj);
res=-1;
} else if ( CHECK_ALWAYS_VERBOSE <= m )
{
- osd_printf_warning("%s:%d: GL Info: object 0x%X linked successful\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Info: object 0x%X linked successful\n", file, line, (unsigned int)(uintptr_t)obj);
}
break;
case GL_OBJECT_VALIDATE_STATUS_ARB:
if(param!=1)
{
if ( CHECK_VERBOSE <= m )
- osd_printf_warning("%s:%d: GL Error: object 0x%X validation failed\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Error: object 0x%X validation failed\n", file, line, (unsigned int)(uintptr_t)obj);
res=-1;
} else if ( CHECK_ALWAYS_VERBOSE <= m )
{
- osd_printf_warning("%s:%d: GL Info: object 0x%X validation successful\n", file, line, (unsigned int)(FPTR)obj);
+ osd_printf_warning("%s:%d: GL Info: object 0x%X validation successful\n", file, line, (unsigned int)(uintptr_t)obj);
}
break;
}
diff --git a/src/osd/modules/render/blit13.h b/src/osd/modules/render/blit13.h
index 22a7a1fcea5..33daf3c5ead 100644
--- a/src/osd/modules/render/blit13.h
+++ b/src/osd/modules/render/blit13.h
@@ -35,13 +35,13 @@ inline UINT32 ycc_to_rgb(const UINT8 y, const UINT8 cb, const UINT8 cr)
inline UINT32 pixel_ycc_to_rgb(const UINT16 *pixel)
{
- const UINT32 p = *(UINT32 *)((FPTR) pixel & ~3);
+ const UINT32 p = *(UINT32 *)((uintptr_t) pixel & ~3);
return ycc_to_rgb((*pixel >> 8) & 0xff, (p) & 0xff, (p>>16) & 0xff);
}
inline UINT32 pixel_ycc_to_rgb_pal(const UINT16 *pixel, const rgb_t *palette)
{
- const UINT32 p = *(UINT32 *)((FPTR) pixel & ~3);
+ const UINT32 p = *(UINT32 *)((uintptr_t) pixel & ~3);
return ycc_to_rgb(palette[(*pixel >> 8) & 0xff], (p) & 0xff, (p>>16) & 0xff);
}
diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp
index 43ce12174e8..70baac2ace6 100644
--- a/src/osd/modules/render/drawd3d.cpp
+++ b/src/osd/modules/render/drawd3d.cpp
@@ -467,7 +467,7 @@ void d3d_texture_manager::delete_resources()
UINT32 d3d_texture_manager::texture_compute_hash(const render_texinfo *texture, UINT32 flags)
{
- return (FPTR)texture->base ^ (flags & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK));
+ return (uintptr_t)texture->base ^ (flags & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK));
}
texture_info *d3d_texture_manager::find_texinfo(const render_texinfo *texinfo, UINT32 flags)
diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h
index b5923482a10..0898448a364 100644
--- a/src/osd/osdcomm.h
+++ b/src/osd/osdcomm.h
@@ -78,16 +78,6 @@ using INT32 = std::int32_t;
using UINT64 = std::uint64_t;
using INT64 = std::int64_t;
-/* pointer-sized values */
-using FPTR = uintptr_t;
-
-/* unicode types */
-using utf16_char = std::uint16_t;
-using unicode_char = std::uint32_t;
-
-
-
-
/***************************************************************************
FUNDAMENTAL CONSTANTS
***************************************************************************/
@@ -161,7 +151,6 @@ constexpr UINT64 little_endianize_int64(UINT64 x) { return flipendian_int64(x);
#endif /* LSB_FIRST */
#ifdef _MSC_VER
-#include <malloc.h>
using ssize_t = std::make_signed_t<size_t>;
#endif
diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h
index 7464e076141..acc9c5b6088 100644
--- a/src/osd/osdcore.h
+++ b/src/osd/osdcore.h
@@ -290,7 +290,7 @@ int osd_get_physical_drive_geometry(const char *filename, UINT32 *cylinders, UIN
The number of characters required to form a Unicode character.
-----------------------------------------------------------------------------*/
-int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t count);
+int osd_uchar_from_osdchar(char32_t *uchar, const char *osdchar, size_t count);
/*-----------------------------------------------------------------------------
@@ -305,7 +305,7 @@ int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t coun
Whether this character is legal in a filename
-----------------------------------------------------------------------------*/
-bool osd_is_valid_filename_char(unicode_char uchar);
+bool osd_is_valid_filename_char(char32_t uchar);
/*-----------------------------------------------------------------------------
@@ -320,7 +320,7 @@ bool osd_is_valid_filename_char(unicode_char uchar);
Whether this character is legal in a file path
-----------------------------------------------------------------------------*/
-bool osd_is_valid_filepath_char(unicode_char uchar);
+bool osd_is_valid_filepath_char(char32_t uchar);
/***************************************************************************
diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h
index 3073a014d02..e16af650e17 100644
--- a/src/osd/osdepend.h
+++ b/src/osd/osdepend.h
@@ -51,7 +51,7 @@ public:
* the pixel values rgb_t(0xff,0xff,0xff,0xff) or
* rgb_t(0x00,0xff,0xff,0xff) for each pixel of a black & white font
*/
- virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs) = 0;
+ virtual bool get_bitmap(char32_t chnum, bitmap_argb32 &bitmap, std::int32_t &width, std::int32_t &xoffs, std::int32_t &yoffs) = 0;
};
// ======================> osd_interface
diff --git a/src/osd/strconv.cpp b/src/osd/strconv.cpp
index 25d651fcf5b..8759f67cce9 100644
--- a/src/osd/strconv.cpp
+++ b/src/osd/strconv.cpp
@@ -282,7 +282,7 @@ std::string from_wstring(const WCHAR *s)
// osd_uchar_from_osdchar
//============================================================
-int osd_uchar_from_osdchar(UINT32 *uchar, const char *osdchar, size_t count)
+int osd_uchar_from_osdchar(char32_t *uchar, const char *osdchar, size_t count)
{
WCHAR wch;
CPINFO cp;
@@ -311,7 +311,7 @@ error:
// osd_uchar_from_osdchar
//============================================================
-int osd_uchar_from_osdchar(unicode_char *uchar, const char *osdchar, size_t count)
+int osd_uchar_from_osdchar(char32_t *uchar, const char *osdchar, size_t count)
{
wchar_t wch;
diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp
index de245a231e0..370d7b7087d 100644
--- a/src/osd/windows/window.cpp
+++ b/src/osd/windows/window.cpp
@@ -1218,7 +1218,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
break;
case WM_CHAR:
- window->machine().ui_input().push_char_event(window->m_target, (unicode_char) wparam);
+ window->machine().ui_input().push_char_event(window->m_target, (char32_t) wparam);
break;
case WM_MOUSEWHEEL: