diff options
Diffstat (limited to 'src/osd/modules')
-rw-r--r-- | src/osd/modules/debugger/qt/debuggerview.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/debugger/qt/memorywindow.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/input/input_common.cpp | 6 | ||||
-rw-r--r-- | src/osd/modules/input/input_common.h | 1 | ||||
-rw-r--r-- | src/osd/modules/input/input_sdl.cpp | 312 | ||||
-rw-r--r-- | src/osd/modules/input/input_x11.cpp | 18 | ||||
-rw-r--r-- | src/osd/modules/lib/osdobj_common.cpp | 32 | ||||
-rw-r--r-- | src/osd/modules/lib/osdobj_common.h | 3 | ||||
-rw-r--r-- | src/osd/modules/osdhelper.h | 61 | ||||
-rw-r--r-- | src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_chroma.sc | 6 | ||||
-rw-r--r-- | src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv3-noblend.sc | 6 | ||||
-rw-r--r-- | src/osd/modules/render/bgfx/shaders/shader.mk | 2 | ||||
-rw-r--r-- | src/osd/modules/render/drawogl.cpp | 32 | ||||
-rw-r--r-- | src/osd/modules/sound/sdl_sound.cpp | 9 |
14 files changed, 369 insertions, 123 deletions
diff --git a/src/osd/modules/debugger/qt/debuggerview.cpp b/src/osd/modules/debugger/qt/debuggerview.cpp index 71a736f6bb7..7dc16c0a3de 100644 --- a/src/osd/modules/debugger/qt/debuggerview.cpp +++ b/src/osd/modules/debugger/qt/debuggerview.cpp @@ -241,7 +241,7 @@ void DebuggerView::mousePressEvent(QMouseEvent* event) { QFontMetrics actualFont = fontMetrics(); const double fontWidth = actualFont.width(QString(100, '_')) / 100.; - const int fontHeight = std::max(1, actualFont.height()); + const int fontHeight = std::max(1, actualFont.lineSpacing()); debug_view_xy topLeft = m_view->visible_position(); debug_view_xy clickViewPosition; diff --git a/src/osd/modules/debugger/qt/memorywindow.cpp b/src/osd/modules/debugger/qt/memorywindow.cpp index 19e3dee6785..c799ab66c65 100644 --- a/src/osd/modules/debugger/qt/memorywindow.cpp +++ b/src/osd/modules/debugger/qt/memorywindow.cpp @@ -329,7 +329,7 @@ void DebuggerMemView::mousePressEvent(QMouseEvent* event) { QFontMetrics actualFont = fontMetrics(); const double fontWidth = actualFont.width(QString(100, '_')) / 100.; - const int fontHeight = std::max(1, actualFont.height()); + const int fontHeight = std::max(1, actualFont.lineSpacing()); debug_view_xy topLeft = view()->visible_position(); debug_view_xy clickViewPosition; diff --git a/src/osd/modules/input/input_common.cpp b/src/osd/modules/input/input_common.cpp index 7c952ac05a4..ab51b6bbe34 100644 --- a/src/osd/modules/input/input_common.cpp +++ b/src/osd/modules/input/input_common.cpp @@ -34,8 +34,8 @@ #elif defined(OSD_SDL) // SDL include #include <SDL2/SDL.h> -#define KEY_TRANS_ENTRY0(mame, sdlsc, sdlkey, disc, virtual, uwp, ascii, UI) { ITEM_ID_##mame, SDL_SCANCODE_ ## sdlsc, SDLK_ ## sdlkey, ascii, "ITEM_ID_"#mame, (char *) UI } -#define KEY_TRANS_ENTRY1(mame, sdlsc, sdlkey, disc, virtual, uwp, ascii) { ITEM_ID_##mame, SDL_SCANCODE_ ## sdlsc, SDLK_ ## sdlkey, ascii, "ITEM_ID_"#mame, (char*) #mame } +#define KEY_TRANS_ENTRY0(mame, sdlsc, sdlkey, disc, virtual, uwp, ascii, UI) { ITEM_ID_##mame, SDL_SCANCODE_ ## sdlsc, ascii, "ITEM_ID_"#mame, (char *) UI } +#define KEY_TRANS_ENTRY1(mame, sdlsc, sdlkey, disc, virtual, uwp, ascii) { ITEM_ID_##mame, SDL_SCANCODE_ ## sdlsc, ascii, "ITEM_ID_"#mame, (char*) #mame } #elif defined(OSD_UWP) #define KEY_TRANS_ENTRY0(mame, sdlsc, sdlkey, disc, virtual, uwp, ascii, UI) { ITEM_ID_##mame, KEY_ ## disc, Windows::System::VirtualKey:: ## uwp, ascii, "ITEM_ID_"#mame, (char *) UI } #define KEY_TRANS_ENTRY1(mame, sdlsc, sdlkey, disc, virtual, uwp, ascii) { ITEM_ID_##mame, KEY_ ## disc, Windows::System::VirtualKey:: ## uwp, ascii, "ITEM_ID_"#mame, (char*) #mame } @@ -43,6 +43,8 @@ // osd mini #endif +// FIXME: sdl_key can be removed from the table below. It is no longer used. + #if defined(OSD_WINDOWS) || defined(OSD_SDL) || defined(OSD_UWP) key_trans_entry keyboard_trans_table::s_default_table[] = { diff --git a/src/osd/modules/input/input_common.h b/src/osd/modules/input/input_common.h index 96a197f2543..b4005a6b76a 100644 --- a/src/osd/modules/input/input_common.h +++ b/src/osd/modules/input/input_common.h @@ -358,7 +358,6 @@ struct key_trans_entry { #if defined(OSD_SDL) int sdl_scancode; - int sdl_key; #elif defined(OSD_WINDOWS) int scan_code; unsigned char virtual_key; diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp index 35dc665f8e2..40fe037f8c7 100644 --- a/src/osd/modules/input/input_sdl.cpp +++ b/src/osd/modules/input/input_sdl.cpp @@ -63,24 +63,265 @@ struct key_lookup_table static key_lookup_table sdl_lookup_table[] = { - KE7(UNKNOWN, BACKSPACE, TAB, CLEAR, RETURN, PAUSE, ESCAPE) + KE(UNKNOWN) + + KE(A) + KE(B) + KE(C) + KE(D) + KE(E) + KE(F) + KE(G) + KE(H) + KE(I) + KE(J) + KE(K) + KE(L) + KE(M) + KE(N) + KE(O) + KE(P) + KE(Q) + KE(R) + KE(S) + KE(T) + KE(U) + KE(V) + KE(W) + KE(X) + KE(Y) + KE(Z) + + KE(1) + KE(2) + KE(3) + KE(4) + KE(5) + KE(6) + KE(7) + KE(8) + KE(9) + KE(0) + + KE(RETURN) + KE(ESCAPE) + KE(BACKSPACE) + KE(TAB) KE(SPACE) - KE5(COMMA, MINUS, PERIOD, SLASH, 0) - KE8(1, 2, 3, 4, 5, 6, 7, 8) - KE3(9, SEMICOLON, EQUALS) - KE5(LEFTBRACKET,BACKSLASH, RIGHTBRACKET, A, B) - KE8(C, D, E, F, G, H, I, J) - KE8(K, L, M, N, O, P, Q, R) - KE8(S, T, U, V, W, X, Y, Z) - KE8(DELETE, KP_0, KP_1, KP_2, KP_3, KP_4, KP_5, KP_6) - KE8(KP_7, KP_8, KP_9, KP_PERIOD, KP_DIVIDE, KP_MULTIPLY,KP_MINUS, KP_PLUS) - KE8(KP_ENTER, KP_EQUALS, UP, DOWN, RIGHT, LEFT, INSERT, HOME) - KE8(END, PAGEUP, PAGEDOWN, F1, F2, F3, F4, F5) - KE8(F6, F7, F8, F9, F10, F11, F12, F13) - KE8(F14, F15, NUMLOCKCLEAR, CAPSLOCK, SCROLLLOCK, RSHIFT, LSHIFT, RCTRL) - KE5(LCTRL, RALT, LALT, LGUI, RGUI) - KE8(GRAVE, LEFTBRACKET,RIGHTBRACKET, SEMICOLON, APOSTROPHE, BACKSLASH, PRINTSCREEN,MENU) + + KE(MINUS) + KE(EQUALS) + KE(LEFTBRACKET) + KE(RIGHTBRACKET) + KE(BACKSLASH) + KE(NONUSHASH) + KE(SEMICOLON) + KE(APOSTROPHE) + KE(GRAVE) + KE(COMMA) + KE(PERIOD) + KE(SLASH) + + KE(CAPSLOCK) + + KE(F1) + KE(F2) + KE(F3) + KE(F4) + KE(F5) + KE(F6) + KE(F7) + KE(F8) + KE(F9) + KE(F10) + KE(F11) + KE(F12) + + KE(PRINTSCREEN) + KE(SCROLLLOCK) + KE(PAUSE) + KE(INSERT) + KE(HOME) + KE(PAGEUP) + KE(DELETE) + KE(END) + KE(PAGEDOWN) + KE(RIGHT) + KE(LEFT) + KE(DOWN) + KE(UP) + + KE(NUMLOCKCLEAR) + KE(KP_DIVIDE) + KE(KP_MULTIPLY) + KE(KP_MINUS) + KE(KP_PLUS) + KE(KP_ENTER) + KE(KP_1) + KE(KP_2) + KE(KP_3) + KE(KP_4) + KE(KP_5) + KE(KP_6) + KE(KP_7) + KE(KP_8) + KE(KP_9) + KE(KP_0) + KE(KP_PERIOD) + + KE(NONUSBACKSLASH) + KE(APPLICATION) + KE(POWER) + KE(KP_EQUALS) + KE(F13) + KE(F14) + KE(F15) + KE(F16) + KE(F17) + KE(F18) + KE(F19) + KE(F20) + KE(F21) + KE(F22) + KE(F23) + KE(F24) + KE(EXECUTE) + KE(HELP) + KE(MENU) + KE(SELECT) + KE(STOP) + KE(AGAIN) KE(UNDO) + KE(CUT) + KE(COPY) + KE(PASTE) + KE(FIND) + KE(MUTE) + KE(VOLUMEUP) + KE(VOLUMEDOWN) + KE(KP_COMMA) + KE(KP_EQUALSAS400) + + KE(INTERNATIONAL1) + KE(INTERNATIONAL2) + KE(INTERNATIONAL3) + KE(INTERNATIONAL4) + KE(INTERNATIONAL5) + KE(INTERNATIONAL6) + KE(INTERNATIONAL7) + KE(INTERNATIONAL8) + KE(INTERNATIONAL9) + KE(LANG1) + KE(LANG2) + KE(LANG3) + KE(LANG4) + KE(LANG5) + KE(LANG6) + KE(LANG7) + KE(LANG8) + KE(LANG9) + + KE(ALTERASE) + KE(SYSREQ) + KE(CANCEL) + KE(CLEAR) + KE(PRIOR) + KE(RETURN2) + KE(SEPARATOR) + KE(OUT) + KE(OPER) + KE(CLEARAGAIN) + KE(CRSEL) + KE(EXSEL) + + KE(KP_00) + KE(KP_000) + KE(THOUSANDSSEPARATOR) + KE(DECIMALSEPARATOR) + KE(CURRENCYUNIT) + KE(CURRENCYSUBUNIT) + KE(KP_LEFTPAREN) + KE(KP_RIGHTPAREN) + KE(KP_LEFTBRACE) + KE(KP_RIGHTBRACE) + KE(KP_TAB) + KE(KP_BACKSPACE) + KE(KP_A) + KE(KP_B) + KE(KP_C) + KE(KP_D) + KE(KP_E) + KE(KP_F) + KE(KP_XOR) + KE(KP_POWER) + KE(KP_PERCENT) + KE(KP_LESS) + KE(KP_GREATER) + KE(KP_AMPERSAND) + KE(KP_DBLAMPERSAND) + KE(KP_VERTICALBAR) + KE(KP_DBLVERTICALBAR) + KE(KP_COLON) + KE(KP_HASH) + KE(KP_SPACE) + KE(KP_AT) + KE(KP_EXCLAM) + KE(KP_MEMSTORE) + KE(KP_MEMRECALL) + KE(KP_MEMCLEAR) + KE(KP_MEMADD) + KE(KP_MEMSUBTRACT) + KE(KP_MEMMULTIPLY) + KE(KP_MEMDIVIDE) + KE(KP_PLUSMINUS) + KE(KP_CLEAR) + KE(KP_CLEARENTRY) + KE(KP_BINARY) + KE(KP_OCTAL) + KE(KP_DECIMAL) + KE(KP_HEXADECIMAL) + + KE(LCTRL) + KE(LSHIFT) + KE(LALT) + KE(LGUI) + KE(RCTRL) + KE(RSHIFT) + KE(RALT) + KE(RGUI) + + KE(MODE) + KE(AUDIONEXT) + KE(AUDIOPREV) + KE(AUDIOSTOP) + KE(AUDIOPLAY) + KE(AUDIOMUTE) + KE(MEDIASELECT) + KE(WWW) + KE(MAIL) + KE(CALCULATOR) + KE(COMPUTER) + KE(AC_SEARCH) + KE(AC_HOME) + KE(AC_BACK) + KE(AC_FORWARD) + KE(AC_STOP) + KE(AC_REFRESH) + KE(AC_BOOKMARKS) + + KE(BRIGHTNESSDOWN) + KE(BRIGHTNESSUP) + KE(DISPLAYSWITCH) + KE(KBDILLUMTOGGLE) + KE(KBDILLUMDOWN) + KE(KBDILLUMUP) + KE(EJECT) + KE(SLEEP) + + KE(APP1) + KE(APP2) + + { -1, "" } @@ -126,7 +367,6 @@ protected: // sdl_keyboard_device //============================================================ -#define OSD_SDL_INDEX_KEYSYM(keysym) ((keysym)->scancode) class sdl_keyboard_device : public sdl_device { public: @@ -143,13 +383,13 @@ public: switch (sdlevent.type) { case SDL_KEYDOWN: - keyboard.state[OSD_SDL_INDEX_KEYSYM(&sdlevent.key.keysym)] = 0x80; + keyboard.state[sdlevent.key.keysym.scancode] = 0x80; if (sdlevent.key.keysym.sym < 0x20) machine().ui_input().push_char_event(osd_common_t::s_window_list.front()->target(), sdlevent.key.keysym.sym); break; case SDL_KEYUP: - keyboard.state[OSD_SDL_INDEX_KEYSYM(&sdlevent.key.keysym)] = 0x00; + keyboard.state[sdlevent.key.keysym.scancode] = 0x00; break; case SDL_TEXTINPUT: @@ -567,11 +807,6 @@ private: char *keymap_filename; FILE *keymap_file; int line = 1; - int index, len, sk, vk, ak; - char buf[256]; - char mks[41]; - char sks[41]; - char kns[41]; int sdl2section = 0; keyboard_trans_table &default_table = keyboard_trans_table::instance(); @@ -601,41 +836,42 @@ private: while (!feof(keymap_file)) { + char buf[256]; + char *ret = fgets(buf, 255, keymap_file); if (ret && buf[0] != '\n' && buf[0] != '#') { buf[255] = 0; - len = strlen(buf); + int len = strlen(buf); if (len && buf[len - 1] == '\n') buf[len - 1] = 0; if (strncmp(buf, "[SDL2]", 6) == 0) { sdl2section = 1; } - else if (((SDLMAME_SDL2) ^ sdl2section) == 0) + else if (sdl2section == 1) { - mks[0] = 0; - sks[0] = 0; - memset(kns, 0, ARRAY_LENGTH(kns)); - sscanf(buf, "%40s %40s %x %x %40c\n", - mks, sks, &vk, &ak, kns); + char mks[41] = {0}; + char sks[41] = {0}; + char kns[41] = {0}; + + int n = sscanf(buf, "%40s %40s %40c\n", mks, sks, kns); + if (n != 3) + osd_printf_error("Keymap: Error on line %d : Expected 3 parameters, got %d\n", line, n); - index = default_table.lookup_mame_index(mks); - sk = lookup_sdl_code(sks); + int index = default_table.lookup_mame_index(mks); + int sk = lookup_sdl_code(sks); if (sk >= 0 && index >= 0) { key_trans_entry &entry = (*custom_table)[index]; - entry.sdl_key = sk; - // vk and ak are not really needed - //key_trans_table[index][VIRTUAL_KEY] = vk; - //key_trans_table[index][ASCII_KEY] = ak; + entry.sdl_scancode = sk; entry.ui_name = auto_alloc_array(machine, char, strlen(kns) + 1); strcpy(entry.ui_name, kns); osd_printf_verbose("Keymap: Mapped <%s> to <%s> with ui-text <%s>\n", sks, mks, kns); } else - osd_printf_warning("Keymap: Error on line %d - %s key not found: %s\n", line, (sk<0) ? "sdl" : "mame", buf); + osd_printf_error("Keymap: Error on line %d - %s key not found: %s\n", line, (sk<0) ? "sdl" : "mame", buf); } } line++; diff --git a/src/osd/modules/input/input_x11.cpp b/src/osd/modules/input/input_x11.cpp index 0762b5ae35d..f7c48a10d87 100644 --- a/src/osd/modules/input/input_x11.cpp +++ b/src/osd/modules/input/input_x11.cpp @@ -401,7 +401,23 @@ public: else if (xevent.type == button_press_type || xevent.type == button_release_type) { XDeviceButtonEvent *button = reinterpret_cast<XDeviceButtonEvent *>(&xevent); - lightgun.buttons[button->button] = (xevent.type == button_press_type) ? 0x80 : 0; + + /* + * SDL/X11 Number the buttons 1,2,3, while windows and other parts of MAME + * like offscreen_reload expect 0,2,1. Transpose buttons 2 and 3, and then + * -1 the button number to align the numbering schemes. + */ + int button_number = button->button; + switch (button_number) + { + case 2: + button_number = 3; + break; + case 3: + button_number = 2; + break; + } + lightgun.buttons[button_number - 1] = (xevent.type == button_press_type) ? 0x80 : 0; } } diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 3cb67e6ded4..d3f5f35192e 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -163,7 +163,7 @@ const options_entry osd_options::s_option_entries[] = }; osd_options::osd_options() -: emu_options() + : emu_options() { add_entries(osd_options::s_option_entries); } @@ -176,20 +176,20 @@ std::list<std::shared_ptr<osd_window>> osd_common_t::s_window_list; //------------------------------------------------- osd_common_t::osd_common_t(osd_options &options) - : osd_output(), m_machine(nullptr), - m_options(options), - m_print_verbose(false), - m_font_module(nullptr), - m_sound(nullptr), - m_debugger(nullptr), - m_midi(nullptr), - m_keyboard_input(nullptr), - m_mouse_input(nullptr), - m_lightgun_input(nullptr), - m_joystick_input(nullptr), - m_output(nullptr), - m_monitor_module(nullptr), - m_watchdog(nullptr) + : osd_output(), m_machine(nullptr) + , m_options(options) + , m_print_verbose(false) + , m_font_module(nullptr) + , m_sound(nullptr) + , m_debugger(nullptr) + , m_midi(nullptr) + , m_keyboard_input(nullptr) + , m_mouse_input(nullptr) + , m_lightgun_input(nullptr) + , m_joystick_input(nullptr) + , m_output(nullptr) + , m_monitor_module(nullptr) + , m_watchdog(nullptr) { osd_output::push(this); } @@ -409,7 +409,6 @@ void osd_common_t::output_callback(osd_output_channel channel, const char *msg, void osd_common_t::init(running_machine &machine) { - // // This function is responsible for initializing the OSD-specific // video and input functionality, and registering that functionality // with the MAME core. @@ -437,7 +436,6 @@ void osd_common_t::init(running_machine &machine) // // Audio initialization may eventually move into here as well, // instead of relying on independent callbacks from each system. - // m_machine = &machine; diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 8c275ebf48d..af4d2d332bc 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -245,11 +245,12 @@ public: // osd_output interface ... virtual void output_callback(osd_output_channel channel, const char *msg, va_list args) override; bool verbose() const { return m_print_verbose; } - void set_verbose(bool print_verbose) { m_print_verbose = print_verbose; } + virtual void set_verbose(bool print_verbose) override { m_print_verbose = print_verbose; } void notify(const char *outname, int32_t value) const { m_output->notify(outname, value); } static std::list<std::shared_ptr<osd_window>> s_window_list; + protected: virtual bool input_init(); virtual void input_pause(); diff --git a/src/osd/modules/osdhelper.h b/src/osd/modules/osdhelper.h index 463d8cdfb48..093c392e249 100644 --- a/src/osd/modules/osdhelper.h +++ b/src/osd/modules/osdhelper.h @@ -6,23 +6,23 @@ // //============================================================ -#pragma once +#ifndef MAME_OSD_MODULES_OSDHELPER_H +#define MAME_OSD_MODULES_OSDHELPER_H -#ifndef __OSDHELPER__ -#define __OSDHELPER__ +#pragma once class osd_dim { public: - osd_dim(const int &w, const int &h) - : m_w(w), m_h(h) - { - } - int width() const { return m_w; } - int height() const { return m_h; } + constexpr osd_dim() : m_w(0), m_h(0) { } + constexpr osd_dim(int w, int h) : m_w(w), m_h(h) { } + + constexpr int width() const { return m_w; } + constexpr int height() const { return m_h; } + + constexpr bool operator!=(const osd_dim &other) { return (m_w != other.width()) || (m_h != other.height()); } + constexpr bool operator==(const osd_dim &other) { return (m_w == other.width()) && (m_h == other.height()); } - bool operator!=(const osd_dim &other) { return (m_w != other.width()) || (m_h != other.height()); } - bool operator==(const osd_dim &other) { return (m_w == other.width()) && (m_h == other.height()); } private: int m_w; int m_h; @@ -31,30 +31,25 @@ private: class osd_rect { public: - osd_rect() - : m_x(0), m_y(0), m_d(0,0) - { - } - osd_rect(const int x, const int y, const int &w, const int &h) - : m_x(x), m_y(y), m_d(w,h) - { - } - osd_rect(const int x, const int y, const osd_dim &d) - : m_x(x), m_y(y), m_d(d) - { - } - int top() const { return m_y; } - int left() const { return m_x; } - int width() const { return m_d.width(); } - int height() const { return m_d.height(); } + constexpr osd_rect() : m_x(0), m_y(0), m_d(0, 0) { } + constexpr osd_rect(int x, int y, int w, int h) : m_x(x), m_y(y), m_d(w, h) { } + constexpr osd_rect(int x, int y, const osd_dim &d) : m_x(x), m_y(y), m_d(d) { } + + constexpr int left() const { return m_x; } + constexpr int top() const { return m_y; } + constexpr int width() const { return m_d.width(); } + constexpr int height() const { return m_d.height(); } + + constexpr osd_dim dim() const { return m_d; } - osd_dim dim() const { return m_d; } + constexpr int right() const { return m_x + m_d.width(); } + constexpr int bottom() const { return m_y + m_d.height(); } - int bottom() const { return m_y + m_d.height(); } - int right() const { return m_x + m_d.width(); } + constexpr osd_rect move_by(int dx, int dy) const { return osd_rect(m_x + dx, m_y + dy, m_d); } + constexpr osd_rect resize(int w, int h) const { return osd_rect(m_x, m_y, w, h); } - osd_rect move_by(int dx, int dy) const { return osd_rect(m_x + dx, m_y + dy, m_d); } - osd_rect resize(int w, int h) const { return osd_rect(m_x, m_y, w, h); } + constexpr bool operator!=(const osd_rect &other) { return (m_x != other.left()) || (m_y != other.top()) || (m_d != other.dim()); } + constexpr bool operator==(const osd_rect &other) { return (m_x == other.left()) && (m_y == other.top()) && (m_d == other.dim()); } private: int m_x; @@ -62,4 +57,4 @@ private: osd_dim m_d; }; -#endif // __OSDHELPER__ +#endif // MAME_OSD_MODULES_OSDHELPER_H diff --git a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_chroma.sc b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_chroma.sc index b76370c0aa9..51bb14676d3 100644 --- a/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_chroma.sc +++ b/src/osd/modules/render/bgfx/shaders/chains/hlsl/fs_chroma.sc @@ -23,9 +23,9 @@ void main() vec4 cout = vec4(0.0, 0.0, 0.0, cin.a); mat3 xy = mat3(u_chroma_a.xyz, u_chroma_b.xyz, u_chroma_c.xyz); const mat3 XYZ_TO_sRGB = mat3( - 3.2406, -1.5372, -0.4986, - -0.9689, 1.8758, 0.0415, - 0.0557, -0.2040, 1.0570 + 3.2406, -0.9689, 0.0557, + -1.5372, 1.8758, -0.2040, + -0.4986, 0.0415, 1.0570 ); for (int i = 0; i < 3; ++i) { diff --git a/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv3-noblend.sc b/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv3-noblend.sc index 8d65128f8fc..554c222db47 100644 --- a/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv3-noblend.sc +++ b/src/osd/modules/render/bgfx/shaders/chains/xbr/fs_xbr-lv3-noblend.sc @@ -166,11 +166,11 @@ void main() // It uses CORNER_C if none of the others are defined. #ifdef CORNER_A vec4 interp_restriction_lv1 = interp_restriction_lv0; -#elif CORNER_B +#elif defined(CORNER_B) vec4 interp_restriction_lv1 = (interp_restriction_lv0 * (neq(f,b) * neq(h,d) + eq(e,i) * neq(f,i4) * neq(h,i5) + eq(e,g) + eq(e,c))); -#elif CORNER_D +#elif defined(CORNER_D) vec4 interp_restriction_lv1 = (interp_restriction_lv0 * (neq(f,b) * neq(h,d) + eq(e,i) * neq(f,i4) * neq(h,i5) + eq(e,g) + eq(e,c)) * (vec4(notEqual(f,f4)) * vec4(notEqual(f,i)) + vec4(notEqual(h,h5)) * vec4(notEqual(h,i)) + vec4(notEqual(h,g)) + vec4(notEqual(f,c)) + eq(b,c1) * eq(d,g0))); -#elif CORNER_C +#elif defined(CORNER_C) vec4 interp_restriction_lv1 = (interp_restriction_lv0 * (neq(f,b) * neq(f,c) + neq(h,d) * neq(h,g) + eq(e,i) * (neq(f,f4) * neq(f,i4) + neq(h,h5) * neq(h,i5)) + eq(e,g) + eq(e,c))); #endif diff --git a/src/osd/modules/render/bgfx/shaders/shader.mk b/src/osd/modules/render/bgfx/shaders/shader.mk index 84035e255fa..e7db3cdc242 100644 --- a/src/osd/modules/render/bgfx/shaders/shader.mk +++ b/src/osd/modules/render/bgfx/shaders/shader.mk @@ -1,5 +1,5 @@ # -# Copyright 2011-2018 Branimir Karadzic. All rights reserved. +# Copyright 2011-2019 Branimir Karadzic. All rights reserved. # License: http://www.opensource.org/licenses/BSD-2-Clause # diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index 98db62fdf1f..95345878cfd 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -2056,8 +2056,9 @@ static inline void copyline_palette16(uint32_t *dst, const uint16_t *src, int wi for (x = 0; x < width; x++) { int srcpix = *src++; + uint32_t dstval = 0xff000000 | palette[srcpix]; for (int x2 = 0; x2 < xprescale; x2++) - *dst++ = 0xff000000 | palette[srcpix]; + *dst++ = dstval; } if (xborderpix) *dst++ = 0xff000000 | palette[*--src]; @@ -2079,8 +2080,9 @@ static inline void copyline_palettea16(uint32_t *dst, const uint16_t *src, int w for (x = 0; x < width; x++) { int srcpix = *src++; + uint32_t dstval = palette[srcpix]; for (int x2 = 0; x2 < xprescale; x2++) - *dst++ = palette[srcpix]; + *dst++ = dstval; } if (xborderpix) *dst++ = palette[*--src]; @@ -2109,10 +2111,9 @@ static inline void copyline_rgb32(uint32_t *dst, const uint32_t *src, int width, for (x = 0; x < width; x++) { rgb_t srcpix = *src++; + uint32_t dstval = 0xff000000 | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()]; for (int x2 = 0; x2 < xprescale; x2++) - { - *dst++ = 0xff000000 | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()]; - } + *dst++ = dstval; } if (xborderpix) { @@ -2129,11 +2130,9 @@ static inline void copyline_rgb32(uint32_t *dst, const uint32_t *src, int width, for (x = 0; x < width; x++) { rgb_t srcpix = *src++; - + uint32_t dstval = 0xff000000 | srcpix; for (int x2 = 0; x2 < xprescale; x2++) - { - *dst++ = 0xff000000 | srcpix; - } + *dst++ = dstval; } if (xborderpix) *dst++ = 0xff000000 | *--src; @@ -2161,8 +2160,9 @@ static inline void copyline_argb32(uint32_t *dst, const uint32_t *src, int width for (x = 0; x < width; x++) { rgb_t srcpix = *src++; + uint32_t dstval = (srcpix & 0xff000000) | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()]; for (int x2 = 0; x2 < xprescale; x2++) - *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()]; + *dst++ = dstval; } if (xborderpix) { @@ -2257,10 +2257,12 @@ static inline void copyline_yuy16_to_argb(uint32_t *dst, const uint16_t *src, in uint16_t srcpix1 = *src++; uint8_t cb = srcpix0 & 0xff; uint8_t cr = srcpix1 & 0xff; + uint32_t dstval0 = ycc_to_rgb(palette[0x000 + (srcpix0 >> 8)], cb, cr); + uint32_t dstval1 = ycc_to_rgb(palette[0x000 + (srcpix1 >> 8)], cb, cr); for (int x2 = 0; x2 < xprescale; x2++) - *dst++ = ycc_to_rgb(palette[0x000 + (srcpix0 >> 8)], cb, cr); + *dst++ = dstval0; for (int x2 = 0; x2 < xprescale; x2++) - *dst++ = ycc_to_rgb(palette[0x000 + (srcpix1 >> 8)], cb, cr); + *dst++ = dstval1; } if (xborderpix) { @@ -2291,10 +2293,12 @@ static inline void copyline_yuy16_to_argb(uint32_t *dst, const uint16_t *src, in uint16_t srcpix1 = *src++; uint8_t cb = srcpix0 & 0xff; uint8_t cr = srcpix1 & 0xff; + uint32_t dstval0 = ycc_to_rgb(srcpix0 >> 8, cb, cr); + uint32_t dstval1 = ycc_to_rgb(srcpix1 >> 8, cb, cr); for (int x2 = 0; x2 < xprescale; x2++) - *dst++ = ycc_to_rgb(srcpix0 >> 8, cb, cr); + *dst++ = dstval0; for (int x2 = 0; x2 < xprescale; x2++) - *dst++ = ycc_to_rgb(srcpix1 >> 8, cb, cr); + *dst++ = dstval1; } if (xborderpix) { diff --git a/src/osd/modules/sound/sdl_sound.cpp b/src/osd/modules/sound/sdl_sound.cpp index a04a44c0298..5ff8f2e6821 100644 --- a/src/osd/modules/sound/sdl_sound.cpp +++ b/src/osd/modules/sound/sdl_sound.cpp @@ -46,7 +46,6 @@ public: sound_sdl() : osd_module(OSD_SOUND_PROVIDER, "sdl"), sound_module(), stream_in_initialized(0), - stream_loop(0), attenuation(0), buf_locked(0), stream_buffer(nullptr), stream_buffer_size(0), buffer_underflows(0), buffer_overflows(0) { sdl_xfer_samples = SDL_XFER_SAMPLES; @@ -80,7 +79,7 @@ private: static void sdl_callback(void *userdata, Uint8 *stream, int len); - int lock_buffer(); + void lock_buffer(); void unlock_buffer(); void attenuate(int16_t *data, int bytes); void copy_sample_data(bool is_throttled, const int16_t *data, int bytes_to_copy); @@ -89,7 +88,6 @@ private: int sdl_xfer_samples; int stream_in_initialized; - int stream_loop; int attenuation; int buf_locked; @@ -179,7 +177,7 @@ int sound_sdl::ring_buffer::pop(void *data, size_t size) //============================================================ // lock_buffer //============================================================ -int sound_sdl::lock_buffer() +void sound_sdl::lock_buffer() { if (!buf_locked) SDL_LockAudio(); @@ -187,8 +185,6 @@ int sound_sdl::lock_buffer() if (LOG_SOUND) *sound_log << "locking\n"; - - return 0; } //============================================================ @@ -359,7 +355,6 @@ int sound_sdl::init(const osd_options &options) sdl_xfer_samples = SDL_XFER_SAMPLES; stream_in_initialized = 0; - stream_loop = 0; // set up the audio specs aspec.freq = sample_rate(); |